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

unable to use vendor as development library #92

Closed
John-Lin opened this issue Dec 19, 2019 · 8 comments
Closed

unable to use vendor as development library #92

John-Lin opened this issue Dec 19, 2019 · 8 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@John-Lin
Copy link
Member

What happened:
I'm trying to import tkeclientset as my development library.

What you expected to happen:

go mod vendor -v without error

How to reproduce it (as minimally and precisely as possible):
go.mod and main.go running go mod vendor -v

Screen Shot 2019-12-19 at 11 22 47 AM

module github.com/John-Lin/client

go 1.13

replace tkestack.io/tke => github.com/tkestack/tke v1.0.1

require tkestack.io/tke v1.0.1
package main

import (
    tkeclientset "tkestack.io/tke/api/client/clientset/versioned"
)

func main() {
    restConfig := &rest.Config{
        Host:        "https://127.0.0.1:9443",
        BearerToken: "token",
        Timeout:     time.Second * 5,
        TLSClientConfig: rest.TLSClientConfig{
            Insecure: true,
        },
    }

    client, err := tkeclientset.NewForConfig(restConfig)
    if err != nil {
        fmt.Printf("%v", err)
    }
}

Anything else we need to know?:

Environment:

  • TKE version: v1.0.1
  • Global or business cluster: None
  • Kubernetes version (use kubectl version): None
  • Install addons: None
@John-Lin John-Lin added the kind/bug Categorizes issue or PR as related to a bug. label Dec 19, 2019
@t1mt
Copy link
Member

t1mt commented Dec 19, 2019

Following this page (https://github.com/golang/go/wiki/Modules#faqs--multi-module-repositories) descirption.

I push a new tag pkg/util/log/glog/v0.0.0 to work around github.com/golang/glog@v0.0.0 unknow revision.

// go.mod
module github.com/t1mt/test
  
go 1.13

require tkestack.io/tke v1.0.1

replace tkestack.io/tke v1.0.1 => github.com/t1mt/tke v1.0.1

replace github.com/golang/glog v0.0.0 => github.com/t1mt/tke/pkg/util/log/glog v0.0.0

But, I got another one

go: tkestack.io/tke@v1.0.1 requires
        k8s.io/api@v0.0.0: reading k8s.io/api/go.mod at revision v0.0.0: unknown revision v0.0.0

@t1mt
Copy link
Member

t1mt commented Dec 19, 2019

I set GOPRIVATE env , but doesn't work.

// go.mod

module github.com/t1mt/test
  
go 1.13

require tkestack.io/tke v1.0.1

replace tkestack.io/tke v1.0.1 => github.com/t1mt/tke v1.0.1
                                                      

image

@choujimmy
Copy link
Contributor

Let me sort out the reference method of the dependency, minimize the use of replace, and facilitate the reference of TKE as a module.

@choujimmy
Copy link
Contributor

I set GOPRIVATE env , but doesn't work.

// go.mod

module github.com/t1mt/test
  
go 1.13

require tkestack.io/tke v1.0.1

replace tkestack.io/tke v1.0.1 => github.com/t1mt/tke v1.0.1
                                                      

image

Yes, my last answer was wrong, so I have deleted

@John-Lin
Copy link
Member Author

Thanks, when will it be ready?

@choujimmy
Copy link
Contributor

It's ok, but you need add replace to your project:

replace (
	// wait https://github.com/chartmuseum/storage/pull/34 to be merged
	github.com/chartmuseum/storage => github.com/choujimmy/storage v0.5.1-0.20191225102245-210f7683d0a6
	github.com/deislabs/oras => github.com/deislabs/oras v0.8.0
	// wait https://github.com/dexidp/dex/pull/1607 to be merged
	github.com/dexidp/dex => github.com/choujimmy/dex v0.0.0-20191225100859-b1cb4b898bb7
	k8s.io/client-go => k8s.io/client-go v0.17.0
)

In kubernetes 1.17.0 and above, the git.etcd.io/etcd package has been referenced by default. If dex/chartmuseum and kubernetes are referenced in the same project, it will cause etcd's authpb to be registered repeatedly and panic will occur.

@John-Lin
Copy link
Member Author

Seems not working @choujimmy
Screen Shot 2019-12-25 at 9 03 04 PM

the fatal error is glog referenceed unknown version

github.com/golang/glog@v0.0.0: reading github.com/golang/glog/go.mod at revision v0.0.0: unknown revision v0.0.0

go.mod has updated like yours

module github.com/John-Lin/client

go 1.13

replace (
        // wait https://github.com/chartmuseum/storage/pull/34 to be merged
        github.com/chartmuseum/storage => github.com/choujimmy/storage v0.5.1-0.20191225102245-210f7683d0a6
        github.com/deislabs/oras => github.com/deislabs/oras v0.8.0
        // wait https://github.com/dexidp/dex/pull/1607 to be merged
        github.com/dexidp/dex => github.com/choujimmy/dex v0.0.0-20191225100859-b1cb4b898bb7
        k8s.io/client-go => k8s.io/client-go v0.17.0
        tkestack.io/tke => github.com/tkestack/tke v1.0.1
)

require tkestack.io/tke v1.0.1

@John-Lin
Copy link
Member Author

it looks like next release will fixed

duyanghao added a commit to duyanghao/cluster-coredns-controller that referenced this issue Mar 11, 2020
Signed-off-by: duyanghao <1294057873@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants