|
1 | 1 | #!/usr/bin/env bash |
2 | 2 | set -e # exit when any command fails |
3 | 3 | set -x # show all commands being run |
4 | | - |
5 | | -# Default to Go 1.18 if GO_VERSION is not set. |
6 | | -# |
7 | | -# Use the "=" operator (instead of the more common ":-" operator) so that it |
8 | | -# allows setting GO_VERSION="" to use the Go installation in the PATH, and it |
9 | | -# sets the GO_VERSION variable if the default is used. |
10 | | -GC=go${GO_VERSION="1.18"} |
11 | | -COMPILE_CHECK_DIR="internal/cmd/compilecheck" |
12 | | - |
13 | | -# compile_check will attempt to build the internal/test/compilecheck project |
14 | | -# using the provided Go version. This is to simulate an end-to-end use case. |
15 | | -function compile_check { |
16 | | - # Change the directory to the compilecheck test directory. |
17 | | - pushd ${COMPILE_CHECK_DIR} |
18 | | - |
19 | | - # If a custom Go version is set using the GO_VERSION env var (e.g. "1.18"), |
20 | | - # add the GOPATH bin directory to PATH and then install that Go version. |
21 | | - if [ ! -z "$GO_VERSION" ]; then |
22 | | - PATH=$(go env GOPATH)/bin:$PATH |
23 | | - export PATH |
24 | | - |
25 | | - go install golang.org/dl/go$GO_VERSION@latest |
26 | | - ${GC} download |
27 | | - fi |
28 | | - |
29 | | - ${GC} version |
30 | | - ${GC} mod tidy |
31 | | - |
32 | | - # Check simple build. |
33 | | - ${GC} build ./... |
34 | | - |
35 | | - # Check build with dynamic linking. |
36 | | - ${GC} build -buildmode=plugin |
37 | | - |
38 | | - # Check build with tags. |
39 | | - ${GC} build $BUILD_TAGS ./... |
40 | | - |
41 | | - # Check build with various architectures. |
42 | | - GOOS=linux GOARCH=386 ${GC} build ./... |
43 | | - GOOS=linux GOARCH=arm ${GC} build ./... |
44 | | - GOOS=linux GOARCH=arm64 ${GC} build ./... |
45 | | - GOOS=linux GOARCH=amd64 ${GC} build ./... |
46 | | - GOOS=linux GOARCH=ppc64le ${GC} build ./... |
47 | | - GOOS=linux GOARCH=s390x ${GC} build ./... |
48 | | - |
49 | | - # Remove the binaries. |
50 | | - rm compilecheck |
51 | | - rm compilecheck.so |
52 | | - |
53 | | - # Change the directory back to the working directory. |
54 | | - popd |
55 | | -} |
56 | | - |
57 | | -compile_check |
| 4 | +# |
| 5 | +## Default to Go 1.18 if GO_VERSION is not set. |
| 6 | +## |
| 7 | +## Use the "=" operator (instead of the more common ":-" operator) so that it |
| 8 | +## allows setting GO_VERSION="" to use the Go installation in the PATH, and it |
| 9 | +## sets the GO_VERSION variable if the default is used. |
| 10 | +#GC=go${GO_VERSION="1.18"} |
| 11 | +#COMPILE_CHECK_DIR="internal/cmd/compilecheck" |
| 12 | +# |
| 13 | +## compile_check will attempt to build the internal/test/compilecheck project |
| 14 | +## using the provided Go version. This is to simulate an end-to-end use case. |
| 15 | +#function compile_check { |
| 16 | +# # Change the directory to the compilecheck test directory. |
| 17 | +# pushd ${COMPILE_CHECK_DIR} |
| 18 | +# |
| 19 | +# # If a custom Go version is set using the GO_VERSION env var (e.g. "1.18"), |
| 20 | +# # add the GOPATH bin directory to PATH and then install that Go version. |
| 21 | +# if [ ! -z "$GO_VERSION" ]; then |
| 22 | +# PATH=$(go env GOPATH)/bin:$PATH |
| 23 | +# export PATH |
| 24 | +# |
| 25 | +# go install golang.org/dl/go$GO_VERSION@latest |
| 26 | +# ${GC} download |
| 27 | +# fi |
| 28 | +# |
| 29 | +# ${GC} version |
| 30 | +# ${GC} mod tidy |
| 31 | +# |
| 32 | +# # Check simple build. |
| 33 | +# ${GC} build ./... |
| 34 | +# |
| 35 | +# # Check build with dynamic linking. |
| 36 | +# ${GC} build -buildmode=plugin |
| 37 | +# |
| 38 | +# # Check build with tags. |
| 39 | +# ${GC} build $BUILD_TAGS ./... |
| 40 | +# |
| 41 | +# # Check build with various architectures. |
| 42 | +# GOOS=linux GOARCH=386 ${GC} build ./... |
| 43 | +# GOOS=linux GOARCH=arm ${GC} build ./... |
| 44 | +# GOOS=linux GOARCH=arm64 ${GC} build ./... |
| 45 | +# GOOS=linux GOARCH=amd64 ${GC} build ./... |
| 46 | +# GOOS=linux GOARCH=ppc64le ${GC} build ./... |
| 47 | +# GOOS=linux GOARCH=s390x ${GC} build ./... |
| 48 | +# |
| 49 | +# # Remove the binaries. |
| 50 | +# rm compilecheck |
| 51 | +# rm compilecheck.so |
| 52 | +# |
| 53 | +# # Change the directory back to the working directory. |
| 54 | +# popd |
| 55 | +#} |
| 56 | +# |
| 57 | +#compile_check |
58 | 58 | ##!/usr/bin/env bash |
59 | 59 | #set -e # exit when any command fails |
60 | 60 | #set -x # show all commands being run |
|
0 commit comments