From 40bc000e6cafe3a7eea32e4361268574050c12c4 Mon Sep 17 00:00:00 2001 From: Juha Hyttinen Date: Tue, 21 Sep 2021 11:53:35 +0300 Subject: [PATCH] Newer go version 1.13 and above support Signed-off-by: Juha Hyttinen Change-Id: If848313eea53e07dee40a876430e423511015cc0 --- ci/Dockerfile | 17 ++++++++++++++++- pkg/xapp/xapp.go | 7 +++++++ pkg/xapp/xapp_test.go | 8 ++++---- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/ci/Dockerfile b/ci/Dockerfile index ed8b36f..69badcf 100755 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -18,6 +18,13 @@ #---------------------------------------------------------- FROM nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-ubuntu18-c-go:1.9.0 as xapp-base + +ARG g16="1.16.4" +RUN wget -nv https://dl.google.com/go/go${g16}.linux-amd64.tar.gz \ + && tar -xf go${g16}.linux-amd64.tar.gz \ + && mv go /opt/go/1.16 \ + && rm -f go*.gz + RUN apt-get update -y \ &&apt-get install -y \ apt-utils \ @@ -32,6 +39,9 @@ RUN apt-get update -y \ curl \ tree +ARG GOVERSION=1.16 +ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/go/${GOVERSION}/bin + RUN curl -s https://packagecloud.io/install/repositories/o-ran-sc/master/script.deb.sh | bash # RMR @@ -74,4 +84,9 @@ RUN make -C /ws go-build RUN make -C /ws go-test-fmt # Test Requires dbaas -RUN make -C /ws go-test +#RUN sed -r "s/^(::1.*)/#\1/" /etc/hosts > /etc/hosts.new \ +# && cat /etc/hosts.new > /etc/hosts \ +# && cat /etc/hosts \ +# && make -C /ws go-test + +RUN make -C /ws go-test diff --git a/pkg/xapp/xapp.go b/pkg/xapp/xapp.go index e8f47ef..ad62e36 100755 --- a/pkg/xapp/xapp.go +++ b/pkg/xapp/xapp.go @@ -29,11 +29,18 @@ import ( "strings" "sync/atomic" "syscall" + "testing" "time" "github.com/spf13/viper" ) +// For testing purpose go version 1.13 -> +var _ = func() bool { + testing.Init() + return true +}() + type ReadyCB func(interface{}) type ShutdownCB func() diff --git a/pkg/xapp/xapp_test.go b/pkg/xapp/xapp_test.go index 8b2a952..b9ea423 100755 --- a/pkg/xapp/xapp_test.go +++ b/pkg/xapp/xapp_test.go @@ -34,10 +34,10 @@ import ( "github.com/stretchr/testify/assert" ) -//var _ = func() bool { -// testing.Init() -// return true -//}() +var _ = func() bool { + testing.Init() + return true +}() type Consumer struct{} -- 2.16.6