greenpau / cni-plugins

CNI Plugins compatible with nftables
Apache License 2.0
48 stars 13 forks source link

go get -u github.com/greenpau/cni-plugins/cmd/cni-xxxx fails with error: cannot find package "github.com/containernetworking/cni/pkg/types/current" #19

Closed spenceee closed 2 years ago

spenceee commented 3 years ago

┌─[spence][rhel8][~/cniplugins] └─▪ go get -u github.com/greenpau/cni-plugins/cmd/cni-nftables-portmap cannot find package "github.com/containernetworking/cni/pkg/types/current" in any of: /usr/lib/golang/src/github.com/containernetworking/cni/pkg/types/current (from $GOROOT) /home/spence/go/src/github.com/containernetworking/cni/pkg/types/current (from $GOPATH)

mo-rijndael commented 2 years ago

same problem on Debian 11 (go 1.15.9 installed from repos)

greenpau commented 2 years ago

@spenceee , @termonoid, please run go env. Need to see what you have there.

mo-rijndael commented 2 years ago

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/termonoid/.cache/go-build"
GOENV="/home/termonoid/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/termonoid/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/termonoid/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.15"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.15/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build788695941=/tmp/go-build -gno-record-gcc-switches"```
greenpau commented 2 years ago

@termonoid , could you please do the following:

export GO111MODULE=on

and then run:

go get -u github.com/greenpau/cni-plugins/cmd/cni-nftables-portmap@latest
mo-rijndael commented 2 years ago

@greenpau it starts downloading modules, but then

go: finding module for package github.com/containernetworking/cni/pkg/types/current
../go/pkg/mod/github.com/greenpau/cni-plugins@v1.0.10/pkg/portmap/cmd.go:7:2: module github.com/containernetworking/cni@latest found (v1.0.1), but does not contain package github.com/containernetworking/cni/pkg/types/current
greenpau commented 2 years ago

@termonoid , I see! Let me quickly release a fix.

greenpau commented 2 years ago

@termonoid , @spenceee , please retest with https://github.com/greenpau/cni-plugins/releases/tag/v1.0.11

go get -u github.com/greenpau/cni-plugins/cmd/cni-nftables-portmap@latest
mo-rijndael commented 2 years ago

@greenpau

$ go get -u github.com/greenpau/cni-plugins/cmd/cni-nftables-portmap@latest
go: cannot use path@version syntax in GOPATH mode

I tried to remove "@latest" and everything works fine. Thank you for such quick resolving <3!

greenpau commented 2 years ago

@termonoid , awesome! Thank you for testing. Closing the issue.