-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add explicit go directive (#19)
* fix: add explicit go directive A missing go directive can lead to inconsistent behaviour between go versions. See https://go.dev/doc/go1.17#missing-go-directive Add an explicit directive to target Go 1.17. * ci: run tests on the two most recent versions of Go * ci: replace go scripts with posix compliant scripts * fix: resolve goimports issues * ci: remove GO111MODULE env from ci As of Go 1.16 module-aware mode is enabled by default so GO111MODULE=on is no longer needed. See https://go.dev/doc/go1.16#go-command This should also help with forward compatibility as GOPATH and GO111MODULE will be removed in the future, See https://github.com/golang/go/wiki/GOPATH#deprecating-and-removing-gopath-development-mode * ci: fix windows bat script * test.bat: propagate the status code to the script's exit code Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co> * lint: set exit status if golint fails * sh: add set -e to shell scripts * test.bat: propagate status codes of other commands * ci: replace golint with staticcheck golint is deprecated and this is consistent with what we're doing in other repositories. * ci: move lint scripts in the main test script Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
- Loading branch information
1 parent
f367fbe
commit 548f212
Showing
13 changed files
with
41 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
set | ||
set GO111MODULE=off | ||
go get -u github.com/elastic/go-licenser | ||
set GO111MODULE=on | ||
go mod verify | ||
go-licenser -d | ||
go run .ci/scripts/check_format.go | ||
go run .ci/scripts/check_lint.go | ||
|
||
mkdir -p build | ||
SET OUT_FILE=build\output-report.out | ||
go test "./..." -v > %OUT_FILE% | type %OUT_FILE% | ||
go get -v -u github.com/jstemmer/go-junit-report | ||
go-junit-report > build\junit-%GO_VERSION%.xml < %OUT_FILE% | ||
|
||
go mod verify || EXIT /B 1 | ||
go run github.com/elastic/go-licenser@latest -d || EXIT /B 1 | ||
|
||
go run honnef.co/go/tools/cmd/staticcheck@2022.1 ./... || EXIT /B 1 | ||
|
||
go run golang.org/x/tools/cmd/goimports@latest -l -local github.com/elastic/go-windows . || EXIT /B 1 | ||
|
||
SET OUTPUT_JSON_FILE=build\output-report.out | ||
SET OUTPUT_JUNIT_FILE=build\junit-%GO_VERSION%.xml | ||
|
||
go run gotest.tools/gotestsum@latest --no-color -f standard-quiet --jsonfile "$OUTPUT_JSON_FILE" --junitfile "$OUTPUT_JUNIT_FILE" ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
GO111MODULE=off go get -u github.com/elastic/go-licenser | ||
go mod verify | ||
go-licenser -d | ||
go run .ci/scripts/check_format.go | ||
go run .ci/scripts/check_lint.go | ||
go run github.com/elastic/go-licenser@latest -d | ||
go run honnef.co/go/tools/cmd/staticcheck@2022.1 ./... | ||
out=$(go run golang.org/x/tools/cmd/goimports@latest -l -local github.com/elastic/go-windows .) | ||
|
||
if [ ! -z "$out" ]; then | ||
printf "Run goimports on the code.\n" | ||
exit 1 | ||
fi | ||
|
||
# Run the tests | ||
set +e | ||
export OUT_FILE="build/test-report.out" | ||
export OUTPUT_JSON_FILE="build/test-report.out" | ||
export OUTPUT_JUNIT_FILE="build/junit-${GO_VERSION}.xml" | ||
mkdir -p build | ||
go test -v ./... | tee ${OUT_FILE} | ||
status=$? | ||
go get -v -u github.com/jstemmer/go-junit-report | ||
go-junit-report > "build/junit-${GO_VERSION}.xml" < ${OUT_FILE} | ||
|
||
exit ${status} | ||
go run gotest.tools/gotestsum@latest --no-color -f standard-quiet --jsonfile "$OUTPUT_JSON_FILE" --junitfile "$OUTPUT_JUNIT_FILE" ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
module github.com/elastic/go-windows | ||
|
||
go 1.17 | ||
|
||
require ( | ||
github.com/pkg/errors v0.8.1 | ||
github.com/stretchr/testify v1.3.0 | ||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a | ||
) | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.0 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters