Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: go get github.com/argoproj/argo-cd #7562

Closed
zhengyansheng opened this issue Oct 28, 2021 · 9 comments
Closed

Error: go get github.com/argoproj/argo-cd #7562

zhengyansheng opened this issue Oct 28, 2021 · 9 comments
Labels
bug Something isn't working

Comments

@zhengyansheng
Copy link

zhengyansheng commented Oct 28, 2021

Describe the bug

this is my code

package main

import (
	"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1/types"

)

type Application struct {
}

// Render return deployment struct
func (a *Application) Render() *types.Application {
	return nil
}

func main() {
}

Version

# go version
go version go1.16.3 darwin/amd64

Logs

# go mod init x
# go mod tidy

go: finding module for package github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1/types
go: downloading github.com/argoproj/argo-cd v1.8.7
x imports
	github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1/types: github.com/argoproj/argo-cd@v1.8.7: verifying module: checksum mismatch
	downloaded: h1:CkIu8p/gcTY/fOZWM2tHuSCIAV2HggXjJftrT1IIT3k=
	gosum.io: h1:w72dPaPuwbWgtYCdVbvXhJu0vc86ud5cQNJs7BM7TEs=

SECURITY ERROR
This download does NOT match the one reported by the checksum server.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.

same type of problem

@zhengyansheng zhengyansheng added the bug Something isn't working label Oct 28, 2021
@zaidizeeshan
Copy link

Problem

This is due to golang checksum mismatch

Important thing: Close your IDE and repeat the steps:

Solution

cd /another/path
go clean -modcache
cd /project/path

Remove go.sum
rm go.sum

then re-generate it
go mod tidy

@zhengyansheng
Copy link
Author

zhengyansheng commented Oct 28, 2021

Problem

This is due to golang checksum mismatch

Important thing: Close your IDE and repeat the steps:

Solution

cd /another/path go clean -modcache cd /project/path

Remove go.sum rm go.sum

then re-generate it go mod tidy

** it's still the same mistake**

(⎈ |281134809827408378-c31ce6092609a48f5b4fab6f48dacc931:zhengyansheng)➜  pkg git:(dev) ✗ cd
(⎈ |281134809827408378-c31ce6092609a48f5b4fab6f48dacc931:zhengyansheng)➜  ~ go clean -modcache
(⎈ |281134809827408378-c31ce6092609a48f5b4fab6f48dacc931:zhengyansheng)➜  ~ cd -
~/go/coding/pkg
(⎈ |281134809827408378-c31ce6092609a48f5b4fab6f48dacc931:zhengyansheng)➜  pkg git:(dev) ✗ rm go.sum
rm: go.sum: No such file or directory
(⎈ |281134809827408378-c31ce6092609a48f5b4fab6f48dacc931:zhengyansheng)➜  pkg git:(dev) ✗ go mod tidy
go: downloading github.com/ghodss/yaml v1.0.0
go: downloading github.com/xanzy/go-gitlab v0.51.1
go: downloading github.com/stretchr/testify v1.7.0
go: downloading k8s.io/api v0.22.2
go: downloading k8s.io/apimachinery v0.22.2
go: downloading sigs.k8s.io/kustomize/api v0.10.0
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading github.com/google/go-querystring v1.0.0
go: downloading github.com/hashicorp/go-cleanhttp v0.5.1
go: downloading github.com/hashicorp/go-retryablehttp v0.6.8
go: downloading golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288
go: downloading golang.org/x/time v0.0.0-20191024005414-555d28b269f0
go: downloading github.com/gogo/protobuf v1.3.2
go: downloading github.com/pkg/errors v0.9.1
go: downloading sigs.k8s.io/kustomize/kyaml v0.12.0
go: downloading sigs.k8s.io/yaml v1.2.0
go: downloading gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f
go: downloading github.com/hashicorp/go-hclog v0.9.2
go: downloading github.com/google/gofuzz v1.1.0
go: downloading k8s.io/klog/v2 v2.9.0
go: downloading gopkg.in/inf.v0 v0.9.1
go: downloading sigs.k8s.io/structured-merge-diff/v4 v4.1.2
go: downloading golang.org/x/net v0.0.0-20210520170846-37e1c6afe023
go: downloading google.golang.org/appengine v1.4.0
go: downloading github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e
go: downloading github.com/google/go-cmp v0.5.5
go: downloading github.com/json-iterator/go v1.1.11
go: downloading github.com/modern-go/reflect2 v1.0.1
go: downloading k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e
go: downloading github.com/go-logr/logr v0.4.0
go: downloading github.com/spf13/pflag v1.0.5
go: downloading github.com/kr/text v0.2.0
go: downloading github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: downloading github.com/go-errors/errors v1.0.1
go: downloading github.com/go-openapi/jsonreference v0.19.3
go: downloading github.com/go-openapi/swag v0.19.5
go: downloading github.com/golang/protobuf v1.5.2
go: downloading github.com/PuerkitoBio/purell v1.1.1
go: downloading github.com/go-openapi/jsonpointer v0.19.3
go: downloading github.com/mailru/easyjson v0.7.0
go: downloading github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
go: downloading golang.org/x/text v0.3.6
go: downloading google.golang.org/protobuf v1.26.0
go: finding module for package github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1/types
go: downloading github.com/argoproj/argo-cd v1.8.7
git.bg.huohua.cn/cloud-native/pkg/kube imports
	github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1/types: github.com/argoproj/argo-cd@v1.8.7: verifying module: checksum mismatch
	downloaded: h1:CkIu8p/gcTY/fOZWM2tHuSCIAV2HggXjJftrT1IIT3k=
	gosum.io: h1:w72dPaPuwbWgtYCdVbvXhJu0vc86ud5cQNJs7BM7TEs=

SECURITY ERROR
This download does NOT match the one reported by the checksum server.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.
(⎈ |281134809827408378-c31ce6092609a48f5b4fab6f48dacc931:zhengyansheng)➜  pkg git:(dev) ✗

kube package

package kube

import (
	"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1/types"

)
//

type Application struct {
}

// Render return deployment struct
func (a *Application) Render() *types.Application {
	return nil
}

@zhengyansheng
Copy link
Author

if i use argocd 2.x, an error is reported as flows

# go mod tidy

go: github.com/argoproj/argo-cd/v2@v2.1.4 requires
	github.com/argoproj/gitops-engine@v0.4.1 requires
	k8s.io/kubernetes@v1.21.0 requires
	k8s.io/api@v0.0.0: reading k8s.io/api/go.mod at revision v0.0.0: unknown revision v0.0.0

@paragones92
Copy link

For importing argocd 2.x, see this comment, it fixes the issue temporally: #4055 (comment)

@zhengyansheng
Copy link
Author

zhengyansheng commented Oct 28, 2021

For importing argocd 2.x, see this comment, it fixes the issue temporally: #4055 (comment)

Hello, there is still a mistake to operate according to your method.

My code

package main

import (
	"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1/types"

)

type Application struct {
}

// Render return deployment struct
func (a *Application) Render() *types.Application {
	return nil
}

func main() {
}

go.mod

cat go.mod

module 3x

go 1.16

require github.com/argoproj/argo-cd/v2 v2.0.5

replace (
	github.com/argoproj/gitops-engine => github.com/argoproj/gitops-engine v0.4.0
	k8s.io/api => k8s.io/api v0.21.0
	k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.21.4
	k8s.io/apimachinery => k8s.io/apimachinery v0.21.4
	k8s.io/apiserver => k8s.io/apiserver v0.21.4
	k8s.io/cli-runtime => k8s.io/cli-runtime v0.21.4
	k8s.io/client-go => k8s.io/client-go v0.21.4
	k8s.io/cloud-provider => k8s.io/cloud-provider v0.21.4
	k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.21.4
	k8s.io/code-generator => k8s.io/code-generator v0.21.4
	k8s.io/component-base => k8s.io/component-base v0.21.4
	k8s.io/component-helpers => k8s.io/component-helpers v0.21.4
	k8s.io/controller-manager => k8s.io/controller-manager v0.21.4
	k8s.io/cri-api => k8s.io/cri-api v0.21.4
	k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.21.4
	k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.21.4
	k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.21.4
	k8s.io/kube-proxy => k8s.io/kube-proxy v0.21.4
	k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.21.4
	k8s.io/kubectl => k8s.io/kubectl v0.21.4
	k8s.io/kubelet => k8s.io/kubelet v0.21.4
	k8s.io/kubernetes => k8s.io/kubernetes v1.21.0
	k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.21.4
	k8s.io/metrics => k8s.io/metrics v0.21.4
	k8s.io/mount-utils => k8s.io/mount-utils v0.21.4
	k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.22.0
	k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.21.4
)

execute my code

# go mod tidy

go: finding module for package github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1/types
go: downloading github.com/argoproj/argo-cd v1.8.7
3x imports
	github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1/types: module github.com/argoproj/argo-cd@latest found (v1.8.7), but does not contain package github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1/types

@rumstead
Copy link
Member

go: downloading github.com/argoproj/argo-cd v1.8.7

Did you update your import?
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1/types" -> "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1/types"(notice the v2)

@zhengyansheng
Copy link
Author

zhengyansheng commented Oct 28, 2021

go: downloading github.com/argoproj/argo-cd v1.8.7

Did you update your import? "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1/types" -> "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1/types"(notice the v2)

After importing and modifying, it is still wrong

# go mod tidy

go: downloading github.com/argoproj/argo-cd/v2 v2.0.5
go: finding module for package github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1/types
go: downloading github.com/argoproj/argo-cd v1.8.7
go: downloading github.com/argoproj/argo-cd/v2 v2.1.5
a3x imports
	github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1/types: module github.com/argoproj/argo-cd/v2@latest found (v2.1.5), but does not contain package github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1/types

This is my step

my code

package main

import (
	"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1/types"  // version: v2
)

type Application struct {
}

// Render return deployment struct
func (a *Application) Render() *types.Application {
	return nil
}

func main() {
}

go.mod

module 3x

go 1.16

require github.com/argoproj/argo-cd/v2 v2.0.5

replace (
	github.com/argoproj/gitops-engine => github.com/argoproj/gitops-engine v0.4.0
	k8s.io/api => k8s.io/api v0.21.0
	k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.21.4
	k8s.io/apimachinery => k8s.io/apimachinery v0.21.4
	k8s.io/apiserver => k8s.io/apiserver v0.21.4
	k8s.io/cli-runtime => k8s.io/cli-runtime v0.21.4
	k8s.io/client-go => k8s.io/client-go v0.21.4
	k8s.io/cloud-provider => k8s.io/cloud-provider v0.21.4
	k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.21.4
	k8s.io/code-generator => k8s.io/code-generator v0.21.4
	k8s.io/component-base => k8s.io/component-base v0.21.4
	k8s.io/component-helpers => k8s.io/component-helpers v0.21.4
	k8s.io/controller-manager => k8s.io/controller-manager v0.21.4
	k8s.io/cri-api => k8s.io/cri-api v0.21.4
	k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.21.4
	k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.21.4
	k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.21.4
	k8s.io/kube-proxy => k8s.io/kube-proxy v0.21.4
	k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.21.4
	k8s.io/kubectl => k8s.io/kubectl v0.21.4
	k8s.io/kubelet => k8s.io/kubelet v0.21.4
	k8s.io/kubernetes => k8s.io/kubernetes v1.21.0
	k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.21.4
	k8s.io/metrics => k8s.io/metrics v0.21.4
	k8s.io/mount-utils => k8s.io/mount-utils v0.21.4
	k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.22.0
	k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.21.4
)

Execute

# go clean -modcache
# go mod tidy

go mod tidy
go: downloading github.com/argoproj/argo-cd/v2 v2.0.5
go: finding module for package github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1/types
go: downloading github.com/argoproj/argo-cd v1.8.7            // ***** incomprehension: Why does it download this version ****
go: downloading github.com/argoproj/argo-cd/v2 v2.1.5
a3x imports
	github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1/types: module github.com/argoproj/argo-cd/v2@latest found (v2.1.5), but does not contain package github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1/types

@rumstead
Copy link
Member

rumstead commented Oct 28, 2021

No need for types at the end of the import.

$ go run ./main.go                                                                                                                                                                                  
hello argocd!

package main

import (
	"fmt"
	argocd "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
)

type Application struct {
}

// Render return deployment struct
func (a *Application) Render() *argocd.Application {
	return nil
}

func main() {
	fmt.Println("hello argocd!")
}
module test

require github.com/argoproj/argo-cd/v2 v2.1.5

replace (
	github.com/argoproj/gitops-engine => github.com/argoproj/gitops-engine v0.4.0
	k8s.io/api => k8s.io/api v0.21.0
	k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.21.4
	k8s.io/apimachinery => k8s.io/apimachinery v0.21.4
	k8s.io/apiserver => k8s.io/apiserver v0.21.4
	k8s.io/cli-runtime => k8s.io/cli-runtime v0.21.4
	k8s.io/client-go => k8s.io/client-go v0.21.4
	k8s.io/cloud-provider => k8s.io/cloud-provider v0.21.4
	k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.21.4
	k8s.io/code-generator => k8s.io/code-generator v0.21.4
	k8s.io/component-base => k8s.io/component-base v0.21.4
	k8s.io/component-helpers => k8s.io/component-helpers v0.21.4
	k8s.io/controller-manager => k8s.io/controller-manager v0.21.4
	k8s.io/cri-api => k8s.io/cri-api v0.21.4
	k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.21.4
	k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.21.4
	k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.21.4
	k8s.io/kube-proxy => k8s.io/kube-proxy v0.21.4
	k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.21.4
	k8s.io/kubectl => k8s.io/kubectl v0.21.4
	k8s.io/kubelet => k8s.io/kubelet v0.21.4
	k8s.io/kubernetes => k8s.io/kubernetes v1.21.0
	k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.21.4
	k8s.io/metrics => k8s.io/metrics v0.21.4
	k8s.io/mount-utils => k8s.io/mount-utils v0.21.4
	k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.22.0
	k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.21.4
)

Go Mod from: #4055 (comment)

@zhengyansheng
Copy link
Author

No need for types at the end of the import.

$ go run ./main.go                                                                                                                                                                                  
hello argocd!
package main

import (
	"fmt"
	argocd "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
)

type Application struct {
}

// Render return deployment struct
func (a *Application) Render() *argocd.Application {
	return nil
}

func main() {
	fmt.Println("hello argocd!")
}
module test

require github.com/argoproj/argo-cd/v2 v2.1.5

replace (
	github.com/argoproj/gitops-engine => github.com/argoproj/gitops-engine v0.4.0
	k8s.io/api => k8s.io/api v0.21.0
	k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.21.4
	k8s.io/apimachinery => k8s.io/apimachinery v0.21.4
	k8s.io/apiserver => k8s.io/apiserver v0.21.4
	k8s.io/cli-runtime => k8s.io/cli-runtime v0.21.4
	k8s.io/client-go => k8s.io/client-go v0.21.4
	k8s.io/cloud-provider => k8s.io/cloud-provider v0.21.4
	k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.21.4
	k8s.io/code-generator => k8s.io/code-generator v0.21.4
	k8s.io/component-base => k8s.io/component-base v0.21.4
	k8s.io/component-helpers => k8s.io/component-helpers v0.21.4
	k8s.io/controller-manager => k8s.io/controller-manager v0.21.4
	k8s.io/cri-api => k8s.io/cri-api v0.21.4
	k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.21.4
	k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.21.4
	k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.21.4
	k8s.io/kube-proxy => k8s.io/kube-proxy v0.21.4
	k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.21.4
	k8s.io/kubectl => k8s.io/kubectl v0.21.4
	k8s.io/kubelet => k8s.io/kubelet v0.21.4
	k8s.io/kubernetes => k8s.io/kubernetes v1.21.0
	k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.21.4
	k8s.io/metrics => k8s.io/metrics v0.21.4
	k8s.io/mount-utils => k8s.io/mount-utils v0.21.4
	k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.22.0
	k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.21.4
)

Go Mod from: #4055 (comment)

Thank you. This problem has been preliminarily solved.
But there is one small problem,

This step

my basic environment

# go env | grep GOPROXY
GOPROXY="https://goproxy.cn,direct"
# go env | grep GOSUM
GOSUMDB="on"

【success】Normal during execution

# git clone git@github.com:zhengyansheng/argocd-pkg.git
# cd argocd-pkg/
# go run main.go
hello argocd!

【Failed】Execution failed

# git clone git@github.com:zhengyansheng/argocd-pkg.git
# cd argocd-pkg/
# go run main.go
hello argocd!
# rm -f go.sum
# go run main.go
go: github.com/argoproj/argo-cd/v2@v2.1.5: missing go.sum entry; to add it:
	go mod download github.com/argoproj/argo-cd/v2

# go mod tidy
go: github.com/argoproj/argo-cd/v2@v2.1.5: verifying go.mod: invalid GOSUMDB: malformed verifier id
# go mod tidy
go: github.com/argoproj/argo-cd/v2@v2.1.5: verifying go.mod: invalid GOSUMDB: malformed verifier id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants