From affb1c2f6617d66bdc9fda41b017e0de000c3691 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Tue, 15 Aug 2017 12:48:02 +0200 Subject: 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. --- go1.4.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'go1.4.go') diff --git a/go1.4.go b/go1.4.go index 939fe91..7c01ce8 100644 --- a/go1.4.go +++ b/go1.4.go @@ -1,5 +1,7 @@ // +build !go1.5 +package main + // Cause an early compile error on Go 1.4 an lower. We need Go 1.5 for a number -// of reasons, among them NewGCMWithNonceSize and RawURLEncoding. -"You need Go 1.5 or higher to compile gocryptfs!" +// of reasons, among them NewGCMWithNonceSize, RawURLEncoding, runtime/trace. +import "You_need_Go_1.5_or_higher_to_compile_gocryptfs" -- cgit v1.2.3