Commit Graph

2 Commits

Author SHA1 Message Date
Jakob Unterwurzacher
affb1c2f66 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.
2017-08-15 12:52:40 +02:00
Jakob Unterwurzacher
e4fdb42496 build.bash: implement "you need Go 1.5" lockout in pure Go
As noticed by @riking, the logic in the bash script will break
when Go 1 version numbers reach double-digits.

Instead, use a build tag "!go1.5" to cause a syntax error:

  $ /opt/go1.4.3/bin/go build
  can't load package: package github.com/rfjakob/gocryptfs:
  go1.4.go:5:1: expected 'package', found 'STRING' "You need Go 1.5 or higher to compile gocryptfs!"

Fixes https://github.com/rfjakob/gocryptfs/issues/133
2017-08-02 23:41:20 +02:00