blob: a82b230cefc8a7a6fc61159923a0e723f9404b64 [file] [log] [blame]
# Test that a basic get go works using golden files to verify output
# Set HOME for go-build cache to be valid
env HOME=$WORK${/}home
env USERPROFILE=$HOME
env LOCALAPPDATA=$WORK${/}appdata
# All the things
cue get go --local
cmp blah_go_gen.cue all.cue.golden
# Use an alternative package name
cue get go --local -p other
cmp blah_go_gen.cue other.cue.golden
-- go.mod --
module mod.com/blah
-- blah.go --
package main
type S struct {
Name string
T
}
type T struct {
Age int
}
const (
LongStringConst = "This is a really long string. Why are we using a long string? Because that way it ensures we are using go/constant.Value.ExactString() instead of go/constant.Value.String()"
IntConst = "test"
)
-- all.cue.golden --
// Code generated by cue get go. DO NOT EDIT.
//cue:generate cue get go mod.com/blah
package main
#S: {
Name: string
T: #T
}
#T: Age: int
#LongStringConst: "This is a really long string. Why are we using a long string? Because that way it ensures we are using go/constant.Value.ExactString() instead of go/constant.Value.String()"
#IntConst: "test"
-- other.cue.golden --
// Code generated by cue get go. DO NOT EDIT.
//cue:generate cue get go mod.com/blah
package other
#S: {
Name: string
T: #T
}
#T: Age: int
#LongStringConst: "This is a really long string. Why are we using a long string? Because that way it ensures we are using go/constant.Value.ExactString() instead of go/constant.Value.String()"
#IntConst: "test"