Skip to content

libcontainer/devices: add '//go:fix inline' directives#5223

Merged
kolyshkin merged 1 commit intoopencontainers:mainfrom
thaJeztah:gofix
Apr 6, 2026
Merged

libcontainer/devices: add '//go:fix inline' directives#5223
kolyshkin merged 1 commit intoopencontainers:mainfrom
thaJeztah: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

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>
@kolyshkin kolyshkin merged commit 80fc1cd into opencontainers:main Apr 6, 2026
55 checks passed
@kolyshkin kolyshkin added the backport/1.5-todo A PR in main branch which needs to be backported to release-1.5 label Apr 6, 2026
@kolyshkin
Copy link
Copy Markdown
Contributor

@thaJeztah thanks! can you please open a backport to 1.5?

@thaJeztah
Copy link
Copy Markdown
Member Author

Sure thing; hope they help. As mentioned; the //go:inline isn't perfect yet (but work is done to improve it), but at least could help in some cases to smoothen the transition; opened a backport;

@kolyshkin kolyshkin added backport/1.5-done A PR in main branch which has been backported to release-1.5 and removed backport/1.5-todo A PR in main branch which needs to be backported to release-1.5 labels Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/1.5-done A PR in main branch which has been backported to release-1.5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants