Skip to content

Commit affb1c2

Browse files
committed
main: rework "you need Go 1.5" lockout to make "go vet" happy
When you run "go vet" explicitely against go1.4.go, it ignores the "+build !go1.5" tag and, of course, throws a syntax error: $ go vet go1.4.go can't load package: package main: go1.4.go:5:1: expected 'package', found 'STRING' "You need Go 1.5 or higher to compile gocryptfs!" Unfortunatey, this is how https://goreportcard.com/ seems to call "go vet", and means we get 0% on the "go vet" test and see this error: An error occurred while running this test (strconv.Atoi: parsing " go1.4.go": invalid syntax) By reworking the logic to use a non-existant package we get an uglier error $ GOROOT=/opt/go1.4.3 /opt/go1.4.3/bin/go build go1.4.go:7:8: cannot find package "You_need_Go_1.5_or_higher_to_compile_gocryptfs" in any of: /opt/go1.4.3/src/You_need_Go_1.5_or_higher_to_compile_gocryptfs (from $GOROOT) /home/jakob/go/src/You_need_Go_1.5_or_higher_to_compile_gocryptfs (from $GOPATH) profiling.go:6:2: cannot find package "runtime/trace" in any of: /opt/go1.4.3/src/runtime/trace (from $GOROOT) /home/jakob/go/src/runtime/trace (from $GOPATH) but make "go vet" happy.
1 parent 0c52084 commit affb1c2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

go1.4.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// +build !go1.5
22

3+
package main
4+
35
// Cause an early compile error on Go 1.4 an lower. We need Go 1.5 for a number
4-
// of reasons, among them NewGCMWithNonceSize and RawURLEncoding.
5-
"You need Go 1.5 or higher to compile gocryptfs!"
6+
// of reasons, among them NewGCMWithNonceSize, RawURLEncoding, runtime/trace.
7+
import "You_need_Go_1.5_or_higher_to_compile_gocryptfs"

0 commit comments

Comments
 (0)