Skip to content

Commit

Permalink
Pin Golang version to 1.15 (#79)
Browse files Browse the repository at this point in the history
* Pin Go version to 1.15

Later versions fail build because of module checksum validation of collectd.org.

* Remove duplicated dependency

Sadly using GH repo for collectd.org dependency did not fix the checksum issue.

* Stop generating go.sum

* Regenerate go.sum

* Don't regenerate go.sum in integration tests
  • Loading branch information
paramite authored Dec 16, 2021
1 parent 46e7f65 commit e6c9935
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,9 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
#- uses: actions/setup-go@v2
# with:
# go-version: '1.15'
#- name: tidy
# run: go mod tidy
- uses: actions/setup-go@v2
with:
go-version: '1.15'
- name: Verify image builds
run: |
docker build --tag infrawatch/sg-core:latest --file build/Dockerfile .
Expand Down
11 changes: 6 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

base=$(pwd)

GOCMD=${GOCMD:-"go"}
PLUGIN_DIR=${PLUGIN_DIR:-"/tmp/plugins/"}
CONTAINER_BUILD=${CONTAINER_BUILD:-false}

Expand Down Expand Up @@ -59,7 +60,7 @@ build_plugins() {
search_list "$(basename $i)" OMIT_TRANSPORTS
if [ $? -ne 1 ]; then
echo "building $(basename $i).so"
go build -o "$PLUGIN_DIR$(basename $i).so" -buildmode=plugin
$GOCMD build -o "$PLUGIN_DIR$(basename $i).so" -buildmode=plugin
fi
done

Expand All @@ -70,7 +71,7 @@ build_plugins() {
search_list "$(basename $i)" OMIT_HANDLERS
if [ $? -ne 1 ]; then
echo "building $(basename $i).so"
go build -o "$PLUGIN_DIR$(basename $i).so" -buildmode=plugin
$GOCMD build -o "$PLUGIN_DIR$(basename $i).so" -buildmode=plugin
fi
done

Expand All @@ -81,7 +82,7 @@ build_plugins() {
search_list "$(basename $i)" OMIT_APPLICATIONS
if [ $? -ne 1 ]; then
echo "building $(basename $i).so"
go build -o "$PLUGIN_DIR$(basename $i).so" -buildmode=plugin
$GOCMD build -o "$PLUGIN_DIR$(basename $i).so" -buildmode=plugin
fi
done
}
Expand All @@ -91,9 +92,9 @@ build_core() {
cd "$base"
if $CONTAINER_BUILD; then
echo "building sg-core for container"
go build -o /tmp/sg-core cmd/*.go
$GOCMD build -o /tmp/sg-core cmd/*.go
else
go build -o sg-core cmd/*.go
$GOCMD build -o sg-core cmd/*.go
fi
}

Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ COPY . $D/
COPY build/repos/opstools.repo /etc/yum.repos.d/opstools.repo

RUN dnf install golang git qpid-proton-c-devel -y --setopt=tsflags=nodocs
RUN PRODUCTION_BUILD=true ./build.sh
RUN go install golang.org/dl/go1.15@latest && /go/bin/go1.15 download && PRODUCTION_BUILD=true GOCMD=/go/bin/go1.15 ./build.sh

# --- end build, create smart gateway layer ---
FROM registry.access.redhat.com/ubi8-minimal:latest
Expand Down
6 changes: 4 additions & 2 deletions ci/integration/logging/run_sg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ dnf install -y git golang gcc make qpid-proton-c-devel
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN

go install golang.org/dl/go1.15@latest
go1.15 download

# install sg-core and start sg-core
go mod tidy
mkdir -p /usr/lib64/sg-core
PLUGIN_DIR=/usr/lib64/sg-core/ ./build.sh
PLUGIN_DIR=/usr/lib64/sg-core/ GOCMD=go1.15 ./build.sh

./sg-core -config ./ci/integration/logging/sg_config.yaml
7 changes: 5 additions & 2 deletions ci/unit/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ yum install -y git golang gcc make glibc-langpack-en qpid-proton-c-devel
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN

go mod tidy
go test -v -coverprofile=profile.cov ./...
go install golang.org/dl/go1.15@latest
go1.15 download


go1.15 test -v -coverprofile=profile.cov ./...
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ module github.com/infrawatch/sg-core
go 1.15

require (
collectd.org v0.5.0 // indirect
collectd.org v0.5.0
github.com/Azure/go-amqp v0.13.9
github.com/collectd/go-collectd v0.5.0
github.com/elastic/go-elasticsearch/v7 v7.10.0
github.com/go-openapi/errors v0.20.0
github.com/go-playground/universal-translator v0.17.0 // indirect
Expand Down
3 changes: 0 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
github.com/collectd/go-collectd v0.5.0 h1:dDXnD+hkw7f3XPNtQm1feda+dGZtzTNWXZID+w0Npxk=
github.com/collectd/go-collectd v0.5.0/go.mod h1:xQe/Em/Q9IrN5ifWOvK5ZP2vMIB4KlsIA550yYzhkpY=
collectd.org v0.5.0 h1:y4uFSAuOmeVhG3GCRa3/oH+ysePfO/+eGJNfd0Qa3d8=
collectd.org v0.5.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
Expand All @@ -47,7 +45,6 @@ github.com/Azure/go-autorest/autorest/adal v0.9.13 h1:Mp5hbtOePIzM8pJVRa3YLrWWmZ
github.com/Azure/go-autorest/autorest/adal v0.9.13/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M=
github.com/Azure/go-autorest/autorest/date v0.3.0 h1:7gUk1U5M/CQbp9WoqinNzJar+8KY+LPI6wiWrP/myHw=
github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74=
github.com/Azure/go-autorest/autorest/mocks v0.4.1 h1:K0laFcLE6VLTOwNgSxaGbUcLPuGXlNkbVvq4cW4nIHk=
github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=
github.com/Azure/go-autorest/autorest/to v0.4.0 h1:oXVqrxakqqV1UZdSazDOPOLvOIz+XA683u8EctwboHk=
github.com/Azure/go-autorest/autorest/to v0.4.0/go.mod h1:fE8iZBn7LQR7zH/9XU2NcPR4o9jEImooCeWJcYV/zLE=
Expand Down
2 changes: 1 addition & 1 deletion plugins/handler/collectd-metrics/pkg/collectd/collectd.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package collectd

import (
"github.com/collectd/go-collectd/cdtime"
"collectd.org/cdtime"
jsoniter "github.com/json-iterator/go"
)

Expand Down

0 comments on commit e6c9935

Please sign in to comment.