Skip to content

Instantly share code, notes, and snippets.

@gifflet
Last active November 29, 2023 14:52
Show Gist options
  • Save gifflet/45113cd160998cccabfc0a219cf69010 to your computer and use it in GitHub Desktop.
Save gifflet/45113cd160998cccabfc0a219cf69010 to your computer and use it in GitHub Desktop.
Importing Go packages in a module

Importing

image

To import the package above the following command is required to be executed in the project root directory:

go get github.com/traefik/traefik/v2

If you want to get an specific version of the package provide the commit hash this way:

go get github.com/traefik/traefik/v2@6a34f238ceb13cb0a81d5d131fdfe1ff2e425f33

Using

For example, if you want to import all the go files inside the folder pkg/provider/kubernetes/crd/traefikio/v1alpha1

image

import (
    traefik "github.com/traefik/traefik/v2/pkg/provider/kubernetes/crd/traefikio/v1alpha1"
)

type Ingress struct {
    ingress                traefik.IngressRouteTCP
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment