Skip to content

Commit

Permalink
Modify go dependencies and code to be compatible with go1.15
Browse files Browse the repository at this point in the history
- downgrade viper dependency to be compatible
- remove any native golang calls introduced in 16+
- update version check for cli compilation script
- add license check skip flag in tarball build
			pr-link: Alluxio#18218
			change-id: cid-bc73e4d4a8c6c78a189f213dbb11ddd4b77e5454
  • Loading branch information
Xenorith authored Sep 27, 2023
1 parent 535d47b commit b5e7b87
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 460 deletions.
4 changes: 2 additions & 2 deletions build/cli/build-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ main() {
exit 1
fi
go_version=$(go version)
if [[ ! ${go_version} =~ ^go\ version\ go1\.(18|19|[2-9][0-9]) ]]; then
echo "Go version must be 1.18 or later, but got ${go_version}"
if [[ ! ${go_version} =~ ^go\ version\ go1\.(1[5-9]|[2-9][0-9]) ]]; then
echo "Go version must be 1.15 or later, but got ${go_version}"
exit 1
fi

Expand Down
10 changes: 8 additions & 2 deletions cli/src/alluxio.org/cli/processes/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,15 @@ func getSigner() (ssh.Signer, error) {
return nil, stacktrace.Propagate(err, "user home directory not found at %v", homePath)
}
privateKeyFile := filepath.Join(homePath, ".ssh", "id_rsa")
privateKey, err := os.ReadFile(privateKeyFile)

f, err := os.Open(privateKeyFile)
if err != nil {
return nil, stacktrace.Propagate(err, "error reading file %v", privateKeyFile)
}
defer f.Close()
privateKey, err := ioutil.ReadAll(f)
if err != nil {
return nil, stacktrace.Propagate(err, "private key file not found at %v", privateKeyFile)
return nil, stacktrace.Propagate(err, "error reading contents of %v", privateKeyFile)
}
parsedPrivateKey, err := ssh.ParsePrivateKey(privateKey)
if err != nil {
Expand Down
29 changes: 5 additions & 24 deletions cli/src/alluxio.org/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module alluxio.org

go 1.18
go 1.15

require (
github.com/iancoleman/orderedmap v0.3.0
Expand All @@ -9,28 +9,9 @@ require (
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.15.0
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/stretchr/testify v1.8.2 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/tklauser/numcpus v0.6.0 // indirect
github.com/spf13/viper v1.6.0
github.com/tklauser/go-sysconf v0.3.0 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5
gopkg.in/yaml.v3 v3.0.1
)
544 changes: 115 additions & 429 deletions cli/src/alluxio.org/go.sum

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,13 @@ func (a *ArtifactGroup) WriteToFile(outputFile string) error {
if err != nil {
return stacktrace.Propagate(err, "error marshalling artifact to yaml")
}
if err := os.WriteFile(outputFile, yOut, os.ModePerm); err != nil {
return stacktrace.Propagate(err, "error writing to file")
f, err := os.OpenFile(outputFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.ModePerm)
if err != nil {
return stacktrace.Propagate(err, "error opening file %v", outputFile)
}
defer f.Close()
if _, err = f.Write(yOut); err != nil {
return stacktrace.Propagate(err, "error writing to file %v", outputFile)
}
return nil
}
1 change: 1 addition & 0 deletions dev/scripts/src/alluxio.org/build/cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ func ConstructMavenCmd(mvnArgs []string) string {
"-Dfindbugs.skip", // skip findbugs static analysis check
"-Dmaven.javadoc.skip", // skip javadoc generation
"-Dcheckstyle.skip", // skip checkstyle static check
"-Dlicense.skip", // skip license header static check
"-Prelease", // release profile specified in root pom.xml, to build dependency-reduced-pom.xml generated by shading plugin
"-Dhttp.keepAlive=false", // disable keep-alive for HTTP requests to deal with connection resets when fetching maven dependencies
}
Expand Down
2 changes: 1 addition & 1 deletion dev/scripts/src/alluxio.org/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module alluxio.org

go 1.18
go 1.15

require (
github.com/palantir/stacktrace v0.0.0-20161112013806-78658fd2d177
Expand Down

0 comments on commit b5e7b87

Please sign in to comment.