faas-cli icon indicating copy to clipboard operation
faas-cli copied to clipboard

Bug: can not update certifier's dependency on faas-cli because it is not a valid go module library

Open LucasRoesler opened this issue 4 years ago • 1 comments

Expected Behaviour

I should be able to update the dependency on the CLI by using

go get github.com/openfaas/faas-cli

Current Behaviour

Can not go get the faas-cli

$ go get github.com/openfaas/faas-cli
github.com/openfaas/faas-cli imports
	github.com/openfaas/faas-cli/commands imports
	github.com/openfaas/faas-cli/proxy imports
	github.com/openfaas/faas/gateway/requests: ambiguous import: found package github.com/openfaas/faas/gateway/requests in multiple modules:
	github.com/openfaas/faas v0.0.0-20200319193403-46b106878d2c (/home/lucas/go/pkg/mod/github.com/openfaas/[email protected]/gateway/requests)
	github.com/openfaas/faas/gateway v0.0.0-20210412154743-52d0165c3f22 (/home/lucas/go/pkg/mod/github.com/openfaas/faas/[email protected]/requests)
github.com/openfaas/faas-cli imports
	github.com/openfaas/faas-cli/commands imports
	github.com/openfaas/faas-cli/proxy imports
	github.com/openfaas/faas/gateway/types: ambiguous import: found package github.com/openfaas/faas/gateway/types in multiple modules:
	github.com/openfaas/faas v0.0.0-20200319193403-46b106878d2c (/home/lucas/go/pkg/mod/github.com/openfaas/[email protected]/gateway/types)
	github.com/openfaas/faas/gateway v0.0.0-20210412154743-52d0165c3f22 (/home/lucas/go/pkg/mod/github.com/openfaas/faas/[email protected]/types)

Are you a GitHub Sponsor (Yes/No?)

Check at: https://github.com/sponsors/openfaas

  • [x] Yes
  • [ ] No

List All Possible Solutions and Workarounds

  1. change the faas-cli dependencies to remove any kind of weirdness and then start making releases with the expected v prefix for go modules
  2. extract the proxy package to the provider repo or to it's own repo so that we can set it up with as few dependencies as possible and ensure that it is a valid go module

Which Solution Do You Recommend?

/shrug I think (2) is probably the easiest to actually do

Steps to Reproduce (for bugs)

Checkout the certifier, and run

go get github.com/openfaas/faas-cli

Context

Found while working on multi-namespace support in the certifier

  1. Setup a local environment to run the certifier
  2. Tail the faas-netes logs using kubectl logs -n openfaas-fn deploy/gateway faas-netes -f
  3. In the certifier, checkout this PR https://github.com/openfaas/certifier/pull/71 and follow the instructions from the PR to run make test-kubernetes
  4. Observe that the faas-netes logs show it requesting logs from the default namespace twice
2021/04/24 15:32:10 test-logger.certifier-test took 0.001226 seconds
2021/04/24 15:32:10 PodInformer: starting informer for faas_function=test-logger in: openfaas-fn
2021/04/24 15:32:10 PodInformer: adding instance: test-logger-cf64c587b-4nzk4
2021/04/24 15:32:10 Logger: starting log stream for test-logger-cf64c587b-4nzk4
2021/04/24 15:32:10 Logger: stopping log stream for test-logger-cf64c587b-4nzk4
2021/04/24 15:32:10 LogHandler: end of log stream

this happens because the version of the proxy package is pretty old and is missing the namespace support for logs, which you can see here https://github.com/openfaas/faas-cli/blob/2cec97955a254358de5443987bedf8ceee272cf8/proxy/logs.go#L65-L67

But i can't upgrade the package via go mod

LucasRoesler avatar Apr 24 '21 15:04 LucasRoesler

I was wondering if I could start the go sum from scratch, but that wont work either

$ rm go.sum
$ go mod tidy
go: downloading go.uber.org/goleak v0.10.0
go: downloading gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127
go: downloading github.com/google/go-cmp v0.2.0
go: downloading github.com/stretchr/testify v1.5.1
go: downloading github.com/kr/text v0.1.0
go: finding module for package github.com/Azure/go-ansiterm/winterm
go: finding module for package github.com/Azure/go-ansiterm
go: finding module for package github.com/Sirupsen/logrus
go: downloading github.com/Sirupsen/logrus v1.8.1
go: found github.com/Azure/go-ansiterm/winterm in github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78
go: found github.com/Azure/go-ansiterm in github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78
go: found github.com/Sirupsen/logrus in github.com/Sirupsen/logrus v1.8.1
go: github.com/openfaas/certifier/tests tested by
	github.com/openfaas/certifier/tests.test imports
	github.com/openfaas/faas-cli/commands imports
	github.com/docker/docker/pkg/term imports
	github.com/docker/docker/pkg/term/windows imports
	github.com/Sirupsen/logrus: github.com/Sirupsen/[email protected]: parsing go.mod:
	module declares its path as: github.com/sirupsen/logrus
	        but was required as: github.com/Sirupsen/logrus

seeing this makes me prefere the option to move proxy to the provider or a separate package so taht it can be a very clean and easy to import module, i would like to avoid any chances of running into these Docker dependencies, which are clearly not needed in the proxy

LucasRoesler avatar Apr 24 '21 16:04 LucasRoesler

Are we OK here? Let me know if it needs reopening.

alexellis avatar Oct 05 '22 16:10 alexellis