You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			47 lines
		
	
	
		
			982 B
		
	
	
	
		
			Plaintext
		
	
			
		
		
	
	
			47 lines
		
	
	
		
			982 B
		
	
	
	
		
			Plaintext
		
	
# Note the proper domain, since the dot adds an edge case.
 | 
						|
env GOPRIVATE=domain.test/main
 | 
						|
 | 
						|
env LDFLAGS='-X=main.unexportedVersion=v1.0.0 -X=domain.test/main/imported.ExportedVar=replaced -X=domain.test/missing/path.missingVar=value'
 | 
						|
 | 
						|
garble build -ldflags=${LDFLAGS}
 | 
						|
exec ./main
 | 
						|
cmp stderr main.stderr
 | 
						|
! binsubstr main$exe 'unexportedVersion'
 | 
						|
 | 
						|
[short] stop # no need to verify this with -short
 | 
						|
 | 
						|
garble -tiny build -ldflags=${LDFLAGS}
 | 
						|
exec ./main
 | 
						|
cmp stderr main.stderr
 | 
						|
! binsubstr main$exe 'unexportedVersion'
 | 
						|
 | 
						|
go build -ldflags=${LDFLAGS}
 | 
						|
exec ./main
 | 
						|
cmp stderr main.stderr
 | 
						|
binsubstr main$exe 'unexportedVersion'
 | 
						|
 | 
						|
-- go.mod --
 | 
						|
module domain.test/main
 | 
						|
 | 
						|
go 1.16
 | 
						|
-- main.go --
 | 
						|
package main
 | 
						|
 | 
						|
import (
 | 
						|
	"domain.test/main/imported"
 | 
						|
)
 | 
						|
 | 
						|
var unexportedVersion = "unknown"
 | 
						|
 | 
						|
func main() {
 | 
						|
	println("version:", unexportedVersion)
 | 
						|
	println("var:", imported.ExportedVar)
 | 
						|
}
 | 
						|
-- imported/imported.go --
 | 
						|
package imported
 | 
						|
 | 
						|
var ExportedVar = "original"
 | 
						|
-- main.stderr --
 | 
						|
version: v1.0.0
 | 
						|
var: replaced
 |