Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The usage of interface in both areas removes the ability to validate when writing back to disk. In the Marshal section of the readme you can use the defined struct in order to Marshal back out https://pkg.go.dev/gopkg.in/yaml.v3#Marshal #80

Closed
l50 opened this issue May 3, 2023 · 2 comments
Assignees
Labels
bug Something isn't working future-aspirations Ideas for the future

Comments

@l50
Copy link
Contributor

l50 commented May 3, 2023

          The usage of interface in both areas removes the ability to validate when writing back to disk. In the Marshal section of the readme you can use the defined struct in order to Marshal back out https://pkg.go.dev/gopkg.in/yaml.v3#Marshal

Originally posted by @CrimsonK1ng in #61 (comment)

@l50 l50 added enhancement New feature or request future aspirations and removed future aspirations labels May 3, 2023
@l50
Copy link
Contributor Author

l50 commented May 15, 2023

TODO: Determine if code is dead. If so, remove it and close issue.

@l50 l50 self-assigned this May 15, 2023
@l50
Copy link
Contributor Author

l50 commented May 15, 2023

Code is not dead, we get these errors when we run our tests when we remove UnmarshalYAML from ttps.go:

=== RUN   TestVariableExpansion
2023-05-15T12:39:34.256-0600	WARN	files/yaml.go:62	No inventory path specified, using current directory
--- FAIL: TestVariableExpansion (0.02s)
panic: reflect.Set: value of type map[string]interface {} is not assignable to type blocks.Step [recovered]
	panic: reflect.Set: value of type map[string]interface {} is not assignable to type blocks.Step [recovered]
	panic: reflect.Set: value of type map[string]interface {} is not assignable to type blocks.Step

goroutine 6 [running]:
testing.tRunner.func1.2({0x1373a80, 0xc00009eb70})
	/Users/jaysong/.gvm/gos/go1.20/src/testing/testing.go:1526 +0x372
testing.tRunner.func1()
	/Users/jaysong/.gvm/gos/go1.20/src/testing/testing.go:1529 +0x650
panic({0x1373a80, 0xc00009eb70})
	/Users/jaysong/.gvm/gos/go1.20/src/runtime/panic.go:890 +0x263
gopkg.in/yaml%2ev3.handleErr(0xc000183028)
	/Users/jaysong/.gvm/pkgsets/go1.20/global/pkg/mod/gopkg.in/[email protected]/yaml.go:294 +0xb9
panic({0x1373a80, 0xc00009eb70})
	/Users/jaysong/.gvm/gos/go1.20/src/runtime/panic.go:890 +0x263
reflect.Value.assignTo({0x1381c00?, 0xc0000c1920?, 0x10b8285?}, {0x13c669c, 0xb}, 0x13a5d40, 0xc00009eb60)
	/Users/jaysong/.gvm/gos/go1.20/src/reflect/value.go:3245 +0x3b4
reflect.Value.Set({0x13a5d40?, 0xc00009eb60?, 0x1?}, {0x1381c00?, 0xc0000c1920?, 0x10c1a05?})
	/Users/jaysong/.gvm/gos/go1.20/src/reflect/value.go:2236 +0xd6
gopkg.in/yaml%2ev3.(*decoder).mapping(0xc0001ec070, 0xc0000d5720, {0x13a5d40?, 0xc00009eb60?, 0x1369d17?})
	/Users/jaysong/.gvm/pkgsets/go1.20/global/pkg/mod/gopkg.in/[email protected]/decode.go:796 +0x312
gopkg.in/yaml%2ev3.(*decoder).unmarshal(0xc0001ec070, 0xc0000d5720, {0x13a5d40?, 0xc00009eb60?, 0xc000010468?})
	/Users/jaysong/.gvm/pkgsets/go1.20/global/pkg/mod/gopkg.in/[email protected]/decode.go:510 +0x5e5
gopkg.in/yaml%2ev3.(*decoder).sequence(0x10587c5?, 0xc0000d5680, {0x136f2a0?, 0xc0001ec028?, 0xc000182538?})
	/Users/jaysong/.gvm/pkgsets/go1.20/global/pkg/mod/gopkg.in/[email protected]/decode.go:753 +0x350
gopkg.in/yaml%2ev3.(*decoder).unmarshal(0xc0001ec070, 0xc0000d5680, {0x136f2a0?, 0xc0001ec028?, 0xc000016918?})
	/Users/jaysong/.gvm/pkgsets/go1.20/global/pkg/mod/gopkg.in/[email protected]/decode.go:512 +0x39b
gopkg.in/yaml%2ev3.(*decoder).mappingStruct(0xc0001ec070, 0xc0000d52c0, {0x13ac280?, 0xc0001ec000?, 0xc0001f4960?})
	/Users/jaysong/.gvm/pkgsets/go1.20/global/pkg/mod/gopkg.in/[email protected]/decode.go:935 +0xf3f
gopkg.in/yaml%2ev3.(*decoder).mapping(0xc0001ec070, 0xc0000d52c0, {0x13ac280?, 0xc0001ec000?, 0x0?})
	/Users/jaysong/.gvm/pkgsets/go1.20/global/pkg/mod/gopkg.in/[email protected]/decode.go:786 +0x20a
gopkg.in/yaml%2ev3.(*decoder).unmarshal(0xc0001ec070, 0xc0000d52c0, {0x13ac280?, 0xc0001ec000?, 0xc000016800?})
	/Users/jaysong/.gvm/pkgsets/go1.20/global/pkg/mod/gopkg.in/[email protected]/decode.go:510 +0x5e5
gopkg.in/yaml%2ev3.(*decoder).document(0xc0001ec070, 0xc0000d5220, {0x13ac280?, 0xc0001ec000?, 0x13a61d7?})
	/Users/jaysong/.gvm/pkgsets/go1.20/global/pkg/mod/gopkg.in/[email protected]/decode.go:527 +0xea
gopkg.in/yaml%2ev3.(*decoder).unmarshal(0xc0001ec070, 0xc0000d5220, {0x13ac280?, 0xc0001ec000?, 0x3438323630337473?})
	/Users/jaysong/.gvm/pkgsets/go1.20/global/pkg/mod/gopkg.in/[email protected]/decode.go:498 +0x685
gopkg.in/yaml%2ev3.unmarshal({0xc0001ee000, 0x2db, 0x380}, {0x13a61a0?, 0xc0001ec000}, 0x7a?)
	/Users/jaysong/.gvm/pkgsets/go1.20/global/pkg/mod/gopkg.in/[email protected]/yaml.go:167 +0x7f4
gopkg.in/yaml%2ev3.Unmarshal(...)
	/Users/jaysong/.gvm/pkgsets/go1.20/global/pkg/mod/gopkg.in/[email protected]/yaml.go:89
github.com/facebookincubator/ttpforge/pkg/blocks.LoadTTP({0xc000022f80, 0x7a})
	/Users/jaysong/pt/tools/ttpforge/pkg/blocks/sync.go:57 +0x105
github.com/facebookincubator/ttpforge/pkg/files.ExecuteYAML({0xc00001a380, 0x1b}, {0x0, 0x0, {0x0, 0x0, 0x0}})
	/Users/jaysong/pt/tools/ttpforge/pkg/files/yaml.go:100 +0x357
github.com/facebookincubator/ttpforge/pkg/runner.runE2ETest(0xc000007d40, {0xc00001a380, 0x1b}, {0xa?}, {0x0, 0x0, 0x0?})
	/Users/jaysong/pt/tools/ttpforge/pkg/runner/execute_test.go:75 +0x49a
github.com/facebookincubator/ttpforge/pkg/runner.TestVariableExpansion(0x0?)
	/Users/jaysong/pt/tools/ttpforge/pkg/runner/execute_test.go:101 +0x2d3
testing.tRunner(0xc000007d40, 0x13f0160)
	/Users/jaysong/.gvm/gos/go1.20/src/testing/testing.go:1576 +0x217
created by testing.(*T).Run
	/Users/jaysong/.gvm/gos/go1.20/src/testing/testing.go:1629 +0x806
FAIL	github.com/facebookincubator/ttpforge/pkg/runner	0.422s

Will require a closer look at some point when time permits

@l50 l50 added future-aspirations Ideas for the future bug Something isn't working and removed enhancement New feature or request labels May 15, 2023
@l50 l50 closed this as completed Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working future-aspirations Ideas for the future
Projects
None yet
Development

No branches or pull requests

1 participant