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

support github.com/coreos/go-systemd/v22 #87

Merged
merged 1 commit into from
Jan 9, 2020

Conversation

AkihiroSuda
Copy link
Contributor

@AkihiroSuda AkihiroSuda commented Jan 9, 2020

Support vendoring github.com/coreos/go-systemd/v22 as follows:

foo.go:

package foo

import (
        "github.com/coreos/go-systemd/v22/dbus"
)

func Foo() (*dbus.Conn, error) {
        return dbus.New()
}

vendor.conf:

github.com/coreos/go-systemd/v22 v22.0.0
github.com/godbus/dbus/v5 v5.0.3

Now vndr checks out the contents of github.com/coreos/[email protected] repo
into the ./vendor/github.com/coreos/go-systemd/v22 directory.

Note that vndr does not verify the actual version number written in go.mod.
So vndr github.com/coreos/go-systemd/v23 v22.0.0 would vendor v22, not v23.

Fix containerd/cgroups#139

@AkihiroSuda AkihiroSuda changed the title support github.com/foo/bar/v42 support "github.com/coreos/go-systemd/v22" Jan 9, 2020
Support vendoring `github.com/coreos/go-systemd/v22` as follows:

`foo.go`:
```go
package foo

import (
        "github.com/coreos/go-systemd/v22/dbus"
)

func Foo() (*dbus.Conn, error) {
        return dbus.New()
}
```

`vendor.conf`:
```
github.com/coreos/go-systemd/v22 v22.0.0
github.com/godbus/dbus/v5 v5.0.3
```

Now `vndr` checks out the contents of `github.com/coreos/[email protected]` repo
into the `./vendor/github.com/coreos/go-systemd/v22` directory.

Note that `vndr` does not verify the actual version number written in `go.mod`.
So `vndr github.com/coreos/go-systemd/v23 v22.0.0` would vendor v22, not v23.

Fix containerd/cgroups#139

Signed-off-by: Akihiro Suda <[email protected]>
@AkihiroSuda AkihiroSuda changed the title support "github.com/coreos/go-systemd/v22" support github.com/coreos/go-systemd/v22 Jan 9, 2020
@thaJeztah
Copy link
Collaborator

Thanks!!

Double checking: dependencies that use the "subdirectory approach" would still need to use the "old" way, right?

So if dependency github.com/foo/bar has a v2 (v<major version>) directory in the repository itself, I would do:

github.com/foo/bar      v2.3.4
github.com/bar/baz      v9.0.1

But for dependencies that only use a tag for v2+, I would use

github.com/foo/bar/v2     v2.3.4
github.com/bar/baz/v9     v9.0.1

@thaJeztah
Copy link
Collaborator

Working on some things, but I'll give this one a try; also thinking if this would support multiple versions of the same package, so

github.com/some/dep     v1.0.1
github.com/some/dep/v2  v2.0.3

I guess that could be supported, but only in the "no subdirectory" case 🤔

@AkihiroSuda
Copy link
Contributor Author

So if dependency github.com/foo/bar has a v2 (v) directory in the repository itself, I would do:

Yes

But for dependencies that only use a tag for v2+, I would use

string in go.mod, not (git) tag?

if this would support multiple versions of the same package, so

Can be another PR?
Is there any specific package that we (Moby & containerd community) want to import in that way?

@thaJeztah
Copy link
Collaborator

string in go.mod, not (git) tag?

Ah, yes, probably (not exactly sure how go mod uses combinations of tags and version in go mod; what does it do if I have a git v2.0.0 tag, but v1 in my go.mod ?

Can be another PR?

Sure! Just thinking out loud

Is there any specific package that we (Moby & containerd community) want to import in that way?

I noticed that the containerd/cgroups package currently uses both a < v2 and v5 version of the godbus/dbus package containerd/cgroups#139 (comment)

(I suspect that's a bug/oversight though; if it is, I'll open a PR to fix that)

@AkihiroSuda
Copy link
Contributor Author

what does it do if I have a git v2.0.0 tag, but v1 in my go.mod ?

Disallowed combo, perhaps?

(I suspect that's a bug/oversight though; if it is, I'll open a PR to fix that)

already fixed in containerd/cgroups#140 😄

@thaJeztah
Copy link
Collaborator

already fixed in containerd/cgroups#140 😄

haha, looks like I'm "too slow" today

Copy link
Collaborator

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

not super-pretty, but I tried this, and it works

@thaJeztah
Copy link
Collaborator

ping @LK4D4 PTAL 🤗 (perhaps a new v0.1.0 version/tag for this would be good?)

@LK4D4
Copy link
Owner

LK4D4 commented Jan 9, 2020

Could we please in next PR add such case to test/testdata/dumproject somewhere? not sure of vndr init supports it at all, though.
I will merge and release new version in the meantime.
Thanks!

@LK4D4 LK4D4 merged commit d385c05 into LK4D4:master Jan 9, 2020
thaJeztah added a commit to thaJeztah/docker that referenced this pull request Jan 9, 2020
With this change, go packages/modules that use versioned
import paths (github.com/foo/bar/v2), but don't use a directory
in the repository, can now be supported.

For example:

```
github.com/coreos/go-systemd/v22 v22.0.0
```

will vendor the github.com/coreos/go-systemd repository
into `vendor/github.com/coreos/go-systemd/v22`.

full diff: LK4D4/vndr@f5ab8fc...v0.1.0

- LK4D4/vndr#83 migrate bitbucket to api 2.0
    - fixes LK4D4/vndr#82 https://api.bitbucket.org/1.0/repositories/ww/goautoneg: 410 Gone
- LK4D4/vndr#86 Replace sort.Sort with sort.Strings
- LK4D4/vndr#87 support `github.com/coreos/go-systemd/v22`

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah
Copy link
Collaborator

Thanks @LK4D4! Yes, I can try finding some time to make up a test case 👍

@AkihiroSuda
Copy link
Contributor Author

sorry, vndr init doesn't seem to work, and not sure how we can support it without parsing go.mod.

#88

AkihiroSuda added a commit to AkihiroSuda/vndr that referenced this pull request Jan 10, 2020
Follow-up to LK4D4#87

Signed-off-by: Akihiro Suda <[email protected]>
AkihiroSuda added a commit to AkihiroSuda/vndr that referenced this pull request Jan 10, 2020
Follow-up to LK4D4#87

Signed-off-by: Akihiro Suda <[email protected]>
@AkihiroSuda AkihiroSuda mentioned this pull request Jan 10, 2020
LK4D4 pushed a commit that referenced this pull request Jan 10, 2020
Follow-up to #87

Signed-off-by: Akihiro Suda <[email protected]>
docker-jenkins pushed a commit to docker-archive/docker-ce that referenced this pull request Jan 10, 2020
With this change, go packages/modules that use versioned
import paths (github.com/foo/bar/v2), but don't use a directory
in the repository, can now be supported.

For example:

```
github.com/coreos/go-systemd/v22 v22.0.0
```

will vendor the github.com/coreos/go-systemd repository
into `vendor/github.com/coreos/go-systemd/v22`.

full diff: LK4D4/vndr@f5ab8fc...v0.1.0

- LK4D4/vndr#83 migrate bitbucket to api 2.0
    - fixes LK4D4/vndr#82 https://api.bitbucket.org/1.0/repositories/ww/goautoneg: 410 Gone
- LK4D4/vndr#86 Replace sort.Sort with sort.Strings
- LK4D4/vndr#87 support `github.com/coreos/go-systemd/v22`

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Upstream-commit: d4f05c168d4497944a1427d830bdf9e69fb2f4c7
Component: engine
thaJeztah added a commit to thaJeztah/cli that referenced this pull request Jan 20, 2020
With this change, go packages/modules that use versioned
import paths (github.com/foo/bar/v2), but don't use a directory
in the repository, can now be supported.

For example:

```
github.com/coreos/go-systemd/v22 v22.0.0
```

will vendor the github.com/coreos/go-systemd repository
into `vendor/github.com/coreos/go-systemd/v22`.

full diff: LK4D4/vndr@f5ab8fc...v0.1.0
LK4D4/vndr@f5ab8fc...v0.1.0

- LK4D4/vndr#79 Add more clear messages around clone failures
- LK4D4/vndr#80 add riscv64 support
- LK4D4/vndr#83 migrate bitbucket to api 2.0
    - fixes LK4D4/vndr#82 https://api.bitbucket.org/1.0/repositories/ww/goautoneg: 410 Gone
- LK4D4/vndr#86 Replace sort.Sort with sort.Strings
- LK4D4/vndr#87 support `github.com/coreos/go-systemd/v22`

Signed-off-by: Sebastiaan van Stijn <[email protected]>
thaJeztah added a commit to thaJeztah/cli that referenced this pull request Jan 20, 2020
With this change, go packages/modules that use versioned
import paths (github.com/foo/bar/v2), but don't use a directory
in the repository, can now be supported.

For example:

```
github.com/coreos/go-systemd/v22 v22.0.0
```

will vendor the github.com/coreos/go-systemd repository
into `vendor/github.com/coreos/go-systemd/v22`.

full diff: LK4D4/vndr@b177b58...v0.1.0

- LK4D4/vndr#79 Add more clear messages around clone failures
- LK4D4/vndr#80 add riscv64 support
- LK4D4/vndr#83 migrate bitbucket to api 2.0
    - fixes LK4D4/vndr#82 https://api.bitbucket.org/1.0/repositories/ww/goautoneg: 410 Gone
- LK4D4/vndr#86 Replace sort.Sort with sort.Strings
- LK4D4/vndr#87 support `github.com/coreos/go-systemd/v22`

Signed-off-by: Sebastiaan van Stijn <[email protected]>
thaJeztah added a commit to thaJeztah/cli that referenced this pull request Jan 27, 2020
With this change, go packages/modules that use versioned
import paths (github.com/foo/bar/v2), but don't use a directory
in the repository, can now be supported.

For example:

```
github.com/coreos/go-systemd/v22 v22.0.0
```

will vendor the github.com/coreos/go-systemd repository
into `vendor/github.com/coreos/go-systemd/v22`.

full diff: LK4D4/vndr@b177b58...v0.1.0

- LK4D4/vndr#79 Add more clear messages around clone failures
- LK4D4/vndr#80 add riscv64 support
- LK4D4/vndr#83 migrate bitbucket to api 2.0
    - fixes LK4D4/vndr#82 https://api.bitbucket.org/1.0/repositories/ww/goautoneg: 410 Gone
- LK4D4/vndr#86 Replace sort.Sort with sort.Strings
- LK4D4/vndr#87 support `github.com/coreos/go-systemd/v22`

Signed-off-by: Sebastiaan van Stijn <[email protected]>
docker-jenkins pushed a commit to docker-archive/docker-ce that referenced this pull request Jan 28, 2020
With this change, go packages/modules that use versioned
import paths (github.com/foo/bar/v2), but don't use a directory
in the repository, can now be supported.

For example:

```
github.com/coreos/go-systemd/v22 v22.0.0
```

will vendor the github.com/coreos/go-systemd repository
into `vendor/github.com/coreos/go-systemd/v22`.

full diff: LK4D4/vndr@b177b58...v0.1.0

- LK4D4/vndr#79 Add more clear messages around clone failures
- LK4D4/vndr#80 add riscv64 support
- LK4D4/vndr#83 migrate bitbucket to api 2.0
    - fixes LK4D4/vndr#82 https://api.bitbucket.org/1.0/repositories/ww/goautoneg: 410 Gone
- LK4D4/vndr#86 Replace sort.Sort with sort.Strings
- LK4D4/vndr#87 support `github.com/coreos/go-systemd/v22`

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Upstream-commit: 7904c23df8cbb8cd8b4c8c3e197c61e91e81548b
Component: cli
thaJeztah added a commit to thaJeztah/docker that referenced this pull request Feb 22, 2020
With this change, go packages/modules that use versioned
import paths (github.com/foo/bar/v2), but don't use a directory
in the repository, can now be supported.

For example:

```
github.com/coreos/go-systemd/v22 v22.0.0
```

will vendor the github.com/coreos/go-systemd repository
into `vendor/github.com/coreos/go-systemd/v22`.

full diff: LK4D4/vndr@f5ab8fc...v0.1.0

- LK4D4/vndr#83 migrate bitbucket to api 2.0
    - fixes LK4D4/vndr#82 https://api.bitbucket.org/1.0/repositories/ww/goautoneg: 410 Gone
- LK4D4/vndr#86 Replace sort.Sort with sort.Strings
- LK4D4/vndr#87 support `github.com/coreos/go-systemd/v22`

Signed-off-by: Sebastiaan van Stijn <[email protected]>
(cherry picked from commit d4f05c1)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
thaJeztah added a commit to thaJeztah/docker that referenced this pull request Mar 12, 2020
With this change, go packages/modules that use versioned
import paths (github.com/foo/bar/v2), but don't use a directory
in the repository, can now be supported.

For example:

```
github.com/coreos/go-systemd/v22 v22.0.0
```

will vendor the github.com/coreos/go-systemd repository
into `vendor/github.com/coreos/go-systemd/v22`.

full diff: LK4D4/vndr@f5ab8fc...v0.1.0

- LK4D4/vndr#83 migrate bitbucket to api 2.0
    - fixes LK4D4/vndr#82 https://api.bitbucket.org/1.0/repositories/ww/goautoneg: 410 Gone
- LK4D4/vndr#86 Replace sort.Sort with sort.Strings
- LK4D4/vndr#87 support `github.com/coreos/go-systemd/v22`

Signed-off-by: Sebastiaan van Stijn <[email protected]>
(cherry picked from commit d4f05c1)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
thaJeztah added a commit to thaJeztah/cli that referenced this pull request Apr 20, 2020
With this change, go packages/modules that use versioned
import paths (github.com/foo/bar/v2), but don't use a directory
in the repository, can now be supported.

For example:

```
github.com/coreos/go-systemd/v22 v22.0.0
```

will vendor the github.com/coreos/go-systemd repository
into `vendor/github.com/coreos/go-systemd/v22`.

full diff: LK4D4/vndr@b177b58...v0.1.0

- LK4D4/vndr#79 Add more clear messages around clone failures
- LK4D4/vndr#80 add riscv64 support
- LK4D4/vndr#83 migrate bitbucket to api 2.0
    - fixes LK4D4/vndr#82 https://api.bitbucket.org/1.0/repositories/ww/goautoneg: 410 Gone
- LK4D4/vndr#86 Replace sort.Sort with sort.Strings
- LK4D4/vndr#87 support `github.com/coreos/go-systemd/v22`

Signed-off-by: Sebastiaan van Stijn <[email protected]>
(cherry picked from commit 7904c23)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
docker-jenkins pushed a commit to docker-archive/docker-ce that referenced this pull request Apr 21, 2020
With this change, go packages/modules that use versioned
import paths (github.com/foo/bar/v2), but don't use a directory
in the repository, can now be supported.

For example:

```
github.com/coreos/go-systemd/v22 v22.0.0
```

will vendor the github.com/coreos/go-systemd repository
into `vendor/github.com/coreos/go-systemd/v22`.

full diff: LK4D4/vndr@b177b58...v0.1.0

- LK4D4/vndr#79 Add more clear messages around clone failures
- LK4D4/vndr#80 add riscv64 support
- LK4D4/vndr#83 migrate bitbucket to api 2.0
    - fixes LK4D4/vndr#82 https://api.bitbucket.org/1.0/repositories/ww/goautoneg: 410 Gone
- LK4D4/vndr#86 Replace sort.Sort with sort.Strings
- LK4D4/vndr#87 support `github.com/coreos/go-systemd/v22`

Signed-off-by: Sebastiaan van Stijn <[email protected]>
(cherry picked from commit 7904c23df8cbb8cd8b4c8c3e197c61e91e81548b)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
Upstream-commit: 950dcedd97f04d2ae9431312fc1256eca6b0e325
Component: cli
eiffel-fl pushed a commit to eiffel-fl/cli that referenced this pull request Jul 28, 2020
With this change, go packages/modules that use versioned
import paths (github.com/foo/bar/v2), but don't use a directory
in the repository, can now be supported.

For example:

```
github.com/coreos/go-systemd/v22 v22.0.0
```

will vendor the github.com/coreos/go-systemd repository
into `vendor/github.com/coreos/go-systemd/v22`.

full diff: LK4D4/vndr@b177b58...v0.1.0

- LK4D4/vndr#79 Add more clear messages around clone failures
- LK4D4/vndr#80 add riscv64 support
- LK4D4/vndr#83 migrate bitbucket to api 2.0
    - fixes LK4D4/vndr#82 https://api.bitbucket.org/1.0/repositories/ww/goautoneg: 410 Gone
- LK4D4/vndr#86 Replace sort.Sort with sort.Strings
- LK4D4/vndr#87 support `github.com/coreos/go-systemd/v22`

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The package cannot be vendored with vndr (regression in #137)
3 participants