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

.github: fix CI #32

Merged
merged 4 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

strategy:
matrix:
go-version: [1.17.x]
go-version: [1.21.x]

steps:
- uses: actions/setup-go@v2
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
- name: golangci-lint check
uses: golangci/golangci-lint-action@v3
with:
version: v1.44.2
version: v1.55.2
args: --timeout=5m
working-directory: src/github.com/fuweid/embedshim

Expand All @@ -70,7 +70,7 @@ jobs:
# based on https://github.com/containerd/project-checks/blob/main/action.yml
project:
name: Project Checks
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
timeout-minutes: 5

steps:
Expand Down Expand Up @@ -128,7 +128,7 @@ jobs:
# ubuntu-22.04 is used to test cgroupv2
# ubuntu-20.04 is for cgroupv1 (common)
matrix:
go-version: [1.17.x]
go-version: [1.21.x]
os: [ubuntu-20.04, ubuntu-22.04]

runs-on: ${{ matrix.os }}
Expand Down
2 changes: 0 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#
linters:
enable:
- structcheck
- varcheck
- staticcheck
- unconvert
- gofmt
Expand Down
5 changes: 1 addition & 4 deletions cmd/embedshim-runcext/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ func newApp() *cli.App {
}
app.Commands = append(app.Commands, execCommand)
app.Before = func(_ *cli.Context) error {
if err := reaper.SetSubreaper(1); err != nil {
return err
}
return nil
return reaper.SetSubreaper(1)
}
return app
}
Expand Down
22 changes: 11 additions & 11 deletions delete_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,46 +29,46 @@ import (
type deletedState struct {
}

func (s *deletedState) Pause(ctx context.Context) error {
func (s *deletedState) Pause(_ context.Context) error {
return fmt.Errorf("cannot pause a deleted process")
}

func (s *deletedState) Resume(ctx context.Context) error {
func (s *deletedState) Resume(_ context.Context) error {
return fmt.Errorf("cannot resume a deleted process")
}

func (s *deletedState) Update(context context.Context, r *google_protobuf.Any) error {
func (s *deletedState) Update(_ context.Context, _ *google_protobuf.Any) error {
return fmt.Errorf("cannot update a deleted process")
}

func (s *deletedState) Checkpoint(ctx context.Context, r *CheckpointConfig) error {
func (s *deletedState) Checkpoint(_ context.Context, _ *CheckpointConfig) error {
return fmt.Errorf("cannot checkpoint a deleted process")
}

func (s *deletedState) Resize(ws console.WinSize) error {
func (s *deletedState) Resize(_ console.WinSize) error {
return fmt.Errorf("cannot resize a deleted process")
}

func (s *deletedState) Start(ctx context.Context) error {
func (s *deletedState) Start(_ context.Context) error {
return fmt.Errorf("cannot start a deleted process")
}

func (s *deletedState) Delete(ctx context.Context) error {
func (s *deletedState) Delete(_ context.Context) error {
return fmt.Errorf("cannot delete a deleted process: %w", errdefs.ErrNotFound)
}

func (s *deletedState) Kill(ctx context.Context, sig uint32, all bool) error {
func (s *deletedState) Kill(_ context.Context, _ uint32, _ bool) error {
return fmt.Errorf("cannot kill a deleted process: %w", errdefs.ErrNotFound)
}

func (s *deletedState) SetExited(status int) {
func (s *deletedState) SetExited(_ int) {
// no op
}

func (s *deletedState) Exec(ctx context.Context, id string, opts runtime.ExecOpts) (runtime.Process, error) {
func (s *deletedState) Exec(_ context.Context, _ string, _ runtime.ExecOpts) (runtime.Process, error) {
return nil, fmt.Errorf("cannot exec in a deleted state")
}

func (s *deletedState) Status(ctx context.Context) (string, error) {
func (s *deletedState) Status(_ context.Context) (string, error) {
return "stopped", nil
}
4 changes: 2 additions & 2 deletions exec_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (e *execProcess) setExited(status int) {
close(e.waitBlock)
}

func (e *execProcess) CloseIO(ctx context.Context) error {
func (e *execProcess) CloseIO(_ context.Context) error {
if stdin := e.Stdin(); stdin != nil {
if err := stdin.Close(); err != nil {
return err
Expand Down Expand Up @@ -214,7 +214,7 @@ func (e *execProcess) Kill(ctx context.Context, sig uint32, _ bool) error {
return e.execState.Kill(ctx, sig, false)
}

func (e *execProcess) kill(ctx context.Context, sig uint32, _ bool) error {
func (e *execProcess) kill(_ context.Context, sig uint32, _ bool) error {
pid := e.pid.get()
switch {
case pid == 0:
Expand Down
16 changes: 8 additions & 8 deletions exec_process_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (s *execCreatedState) SetExited(status int) {
}
}

func (s *execCreatedState) Status(ctx context.Context) (string, error) {
func (s *execCreatedState) Status(_ context.Context) (string, error) {
return "created", nil
}

Expand All @@ -104,11 +104,11 @@ func (s *execRunningState) Resize(ws console.WinSize) error {
return s.p.resize(ws)
}

func (s *execRunningState) Start(ctx context.Context) error {
func (s *execRunningState) Start(_ context.Context) error {
return fmt.Errorf("cannot start a running process")
}

func (s *execRunningState) Delete(ctx context.Context) error {
func (s *execRunningState) Delete(_ context.Context) error {
return fmt.Errorf("cannot delete a running process")
}

Expand All @@ -124,7 +124,7 @@ func (s *execRunningState) SetExited(status int) {
}
}

func (s *execRunningState) Status(ctx context.Context) (string, error) {
func (s *execRunningState) Status(_ context.Context) (string, error) {
return "running", nil
}

Expand All @@ -142,11 +142,11 @@ func (s *execStoppedState) transition(name string) error {
return nil
}

func (s *execStoppedState) Resize(ws console.WinSize) error {
func (s *execStoppedState) Resize(_ console.WinSize) error {
return fmt.Errorf("cannot resize a stopped container")
}

func (s *execStoppedState) Start(ctx context.Context) error {
func (s *execStoppedState) Start(_ context.Context) error {
return fmt.Errorf("cannot start a stopped process")
}

Expand All @@ -162,10 +162,10 @@ func (s *execStoppedState) Kill(ctx context.Context, sig uint32, all bool) error
return s.p.kill(ctx, sig, all)
}

func (s *execStoppedState) SetExited(status int) {
func (s *execStoppedState) SetExited(_ int) {
// no op
}

func (s *execStoppedState) Status(ctx context.Context) (string, error) {
func (s *execStoppedState) Status(_ context.Context) (string, error) {
return "stopped", nil
}
2 changes: 1 addition & 1 deletion init_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ func (p *initProcess) exec(ctx context.Context, execID string, opts runtime.Exec
}

// Checkpoint the init process
func (p *initProcess) Checkpoint(ctx context.Context, r *CheckpointConfig) error {
func (p *initProcess) Checkpoint(_ context.Context, _ *CheckpointConfig) error {
return fmt.Errorf("checkpoint not implemented yet")
}

Expand Down
50 changes: 25 additions & 25 deletions init_process_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,19 @@ func (s *createdState) transition(name string) error {
return nil
}

func (s *createdState) Pause(ctx context.Context) error {
func (s *createdState) Pause(_ context.Context) error {
return fmt.Errorf("cannot pause task in created state")
}

func (s *createdState) Resume(ctx context.Context) error {
func (s *createdState) Resume(_ context.Context) error {
return fmt.Errorf("cannot resume task in created state")
}

func (s *createdState) Update(ctx context.Context, r *google_protobuf.Any) error {
return s.p.update(ctx, r)
}

func (s *createdState) Checkpoint(ctx context.Context, r *CheckpointConfig) error {
func (s *createdState) Checkpoint(_ context.Context, _ *CheckpointConfig) error {
return fmt.Errorf("cannot checkpoint a task in created state")
}

Expand Down Expand Up @@ -115,7 +115,7 @@ func (s *createdState) Exec(ctx context.Context, id string, opts runtime.ExecOpt
return s.p.exec(ctx, id, opts)
}

func (s *createdState) Status(ctx context.Context) (string, error) {
func (s *createdState) Status(_ context.Context) (string, error) {
return "created", nil
}

Expand All @@ -135,27 +135,27 @@ func (s *runningState) transition(name string) error {
return nil
}

func (s *runningState) Pause(ctx context.Context) error {
func (s *runningState) Pause(_ context.Context) error {
return fmt.Errorf("pause not implemented yet")
}

func (s *runningState) Resume(ctx context.Context) error {
func (s *runningState) Resume(_ context.Context) error {
return fmt.Errorf("cannot resume a running process")
}

func (s *runningState) Update(ctx context.Context, r *google_protobuf.Any) error {
return s.p.update(ctx, r)
}

func (s *runningState) Checkpoint(ctx context.Context, r *CheckpointConfig) error {
func (s *runningState) Checkpoint(_ context.Context, _ *CheckpointConfig) error {
return fmt.Errorf("checkpoint not implemented yet")
}

func (s *runningState) Start(ctx context.Context) error {
func (s *runningState) Start(_ context.Context) error {
return fmt.Errorf("cannot start a running process")
}

func (s *runningState) Delete(ctx context.Context) error {
func (s *runningState) Delete(_ context.Context) error {
return fmt.Errorf("cannot delete a running process")
}

Expand All @@ -175,7 +175,7 @@ func (s *runningState) Exec(ctx context.Context, id string, opts runtime.ExecOpt
return s.p.exec(ctx, id, opts)
}

func (s *runningState) Status(ctx context.Context) (string, error) {
func (s *runningState) Status(_ context.Context) (string, error) {
return "running", nil
}

Expand All @@ -195,27 +195,27 @@ func (s *pausedState) transition(name string) error {
return nil
}

func (s *pausedState) Pause(ctx context.Context) error {
func (s *pausedState) Pause(_ context.Context) error {
return fmt.Errorf("cannot pause a paused container")
}

func (s *pausedState) Resume(ctx context.Context) error {
func (s *pausedState) Resume(_ context.Context) error {
return fmt.Errorf("resume not implemented yet")
}

func (s *pausedState) Update(ctx context.Context, r *google_protobuf.Any) error {
return s.p.update(ctx, r)
}

func (s *pausedState) Checkpoint(ctx context.Context, r *CheckpointConfig) error {
func (s *pausedState) Checkpoint(_ context.Context, _ *CheckpointConfig) error {
return fmt.Errorf("checkpoint not implemented yet")
}

func (s *pausedState) Start(ctx context.Context) error {
func (s *pausedState) Start(_ context.Context) error {
return fmt.Errorf("cannot start a paused process")
}

func (s *pausedState) Delete(ctx context.Context) error {
func (s *pausedState) Delete(_ context.Context) error {
return fmt.Errorf("cannot delete a paused process")
}

Expand All @@ -235,11 +235,11 @@ func (s *pausedState) SetExited(status int) {
}
}

func (s *pausedState) Exec(ctx context.Context, id string, opts runtime.ExecOpts) (runtime.Process, error) {
func (s *pausedState) Exec(_ context.Context, _ string, _ runtime.ExecOpts) (runtime.Process, error) {
return nil, fmt.Errorf("cannot exec in a paused state")
}

func (s *pausedState) Status(ctx context.Context) (string, error) {
func (s *pausedState) Status(_ context.Context) (string, error) {
return "paused", nil
}

Expand All @@ -257,23 +257,23 @@ func (s *stoppedState) transition(name string) error {
return nil
}

func (s *stoppedState) Pause(ctx context.Context) error {
func (s *stoppedState) Pause(_ context.Context) error {
return fmt.Errorf("cannot pause a stopped container")
}

func (s *stoppedState) Resume(ctx context.Context) error {
func (s *stoppedState) Resume(_ context.Context) error {
return fmt.Errorf("cannot resume a stopped container")
}

func (s *stoppedState) Update(ctx context.Context, r *google_protobuf.Any) error {
func (s *stoppedState) Update(_ context.Context, _ *google_protobuf.Any) error {
return fmt.Errorf("cannot update a stopped container")
}

func (s *stoppedState) Checkpoint(ctx context.Context, r *CheckpointConfig) error {
func (s *stoppedState) Checkpoint(_ context.Context, _ *CheckpointConfig) error {
return fmt.Errorf("cannot checkpoint a stopped container")
}

func (s *stoppedState) Start(ctx context.Context) error {
func (s *stoppedState) Start(_ context.Context) error {
return fmt.Errorf("cannot start a stopped process")
}

Expand All @@ -288,15 +288,15 @@ func (s *stoppedState) Kill(ctx context.Context, sig uint32, all bool) error {
return s.p.kill(ctx, sig, all)
}

func (s *stoppedState) SetExited(status int) {
func (s *stoppedState) SetExited(_ int) {
// no op
}

func (s *stoppedState) Exec(ctx context.Context, id string, opts runtime.ExecOpts) (runtime.Process, error) {
func (s *stoppedState) Exec(_ context.Context, _ string, _ runtime.ExecOpts) (runtime.Process, error) {
return nil, fmt.Errorf("cannot exec in a stopped state")
}

func (s *stoppedState) Status(ctx context.Context) (string, error) {
func (s *stoppedState) Status(_ context.Context) (string, error) {
return "stopped", nil
}

Expand Down
4 changes: 2 additions & 2 deletions io.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func (p *processIO) CopyStdin() error {
return nil
}

func createIO(ctx context.Context, id string, ioUID, ioGID int, stdio stdio.Stdio) (*processIO, error) {
func createIO(_ context.Context, _ string, ioUID, ioGID int, stdio stdio.Stdio) (*processIO, error) {
pio := &processIO{
stdio: stdio,
}
Expand Down Expand Up @@ -289,7 +289,7 @@ func withConditionalIO(c stdio.Stdio) runc.IOOpt {
}
}

func openRWFifo(ctx context.Context, fn string, perm os.FileMode) (*os.File, error) {
func openRWFifo(_ context.Context, fn string, perm os.FileMode) (*os.File, error) {
if _, err := os.Stat(fn); err != nil {
if os.IsNotExist(err) {
if err := syscall.Mkfifo(fn, uint32(perm&os.ModePerm)); err != nil && !os.IsExist(err) {
Expand Down
Loading
Loading