Skip to content

[1.5 backport] libcontainer/devices: add '//go:fix inline' directives#5225

Merged
lifubang merged 1 commit intoopencontainers:release-1.5from
thaJeztah:1.5_backport_gofix
Apr 7, 2026
Merged

[1.5 backport] libcontainer/devices: add '//go:fix inline' directives#5225
lifubang merged 1 commit intoopencontainers:release-1.5from
thaJeztah:1.5_backport_gofix

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

This allows users to automaticaly migrate to the new location using go fix. It has some limitations, but can help smoothen the transition; for example, taking this file;

package main

import (
	"github.com/opencontainers/runc/libcontainer/devices"
)

func main() {
	_, _ = devices.DeviceFromPath("a", "b")
	_, _ = devices.HostDevices()
	_, _ = devices.GetDevices("a")
}

Running go fix -mod=readonly ./... will migrate the code;

package main

import (
	devices0 "github.com/moby/sys/devices"
)

func main() {
	_, _ = devices0.DeviceFromPath("a", "b")
	_, _ = devices0.HostDevices()
	_, _ = devices0.GetDevices("a")
}

updates b345c78

(cherry picked from commit ba83c7c)

This allows users to automaticaly migrate to the new location
using `go fix`. It has some limitations, but can help smoothen
the transition; for example, taking this file;

```
package main

import (
	"github.com/opencontainers/runc/libcontainer/devices"
)

func main() {
	_, _ = devices.DeviceFromPath("a", "b")
	_, _ = devices.HostDevices()
	_, _ = devices.GetDevices("a")
}
```

Running `go fix -mod=readonly ./...` will migrate the code;

```
package main

import (
	devices0 "github.com/moby/sys/devices"
)

func main() {
	_, _ = devices0.DeviceFromPath("a", "b")
	_, _ = devices0.HostDevices()
	_, _ = devices0.GetDevices("a")
}
```

updates b345c78

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit ba83c7c)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@lifubang lifubang merged commit 8583683 into opencontainers:release-1.5 Apr 7, 2026
89 of 90 checks passed
@thaJeztah thaJeztah deleted the 1.5_backport_gofix branch April 7, 2026 15:57
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.

4 participants