-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix: launch script would fail if yarn was not run before #1990
Conversation
Codecov Report
|
pkg/version/minversion/minversion.go
Outdated
@@ -0,0 +1,18 @@ | |||
// Ensure that users are running Go 1.11 or newer | |||
|
|||
// Package minversion prints a boolean stating whether users are running the minimum required Go version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Package minversion prints a boolean stating whether users are running the minimum required Go version. | |
// Command minversion prints a boolean stating whether users are running the minimum required Go version. |
dev/launch.sh
Outdated
|
||
if [ "$goversion" == "$min" ] && [ "$goversion" != "$minimumgo" ] ; then | ||
echo "Go version $minimumgo is required; found $goversion" | ||
goversion_above_111=$(go run ./pkg/version/minversion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this variable should reference the actual version being enforced (as that is contained within the minversion binary).
pkg/version/minversion/minversion.go
Outdated
func main() { | ||
rawVersion := runtime.Version() | ||
versionNumber := strings.TrimPrefix(rawVersion, "go") | ||
fmt.Println(version.Compare("1.11.0", versionNumber, "<=")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be easier and more natural to rely on exit codes instead
os.Exit(1)
// minimum version not met means non-zero exit code
pkg/version/minversion/minversion.go
Outdated
@@ -0,0 +1,18 @@ | |||
// Ensure that users are running Go 1.11 or newer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove this comment and just leave the package comment.
@nicksnyder based on your comments I just moved everything (including exit + error message) into the minversion command, and run it in the launch script. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume that you tested to make sure that launch.sh terminates if minversion exits with a non-zero exit code
pkg/version/minversion/minversion.go
Outdated
@@ -0,0 +1,22 @@ | |||
// Command minversion prints a boolean stating whether users are running the minimum required Go version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update comment
Fixes https://github.com/sourcegraph/sourcegraph/issues/1914 using the solution described in https://github.com/sourcegraph/sourcegraph/issues/1914#issuecomment-454685052.