Skip to content

Commit 3042d7b

Browse files
committed
Add lint job, fix use of deprecated exec.Stream
1 parent 8a2b2c1 commit 3042d7b

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.gitignore

.github/workflows/docker-build.yml renamed to .github/workflows/build.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
name: Build Docker image
1+
name: Build
22

33
on:
44
push:
55
branches:
6-
- main
6+
- main
77
tags:
8-
- v*.*.*
8+
- v*.*.*
99
pull_request:
1010
branches:
11-
- main
11+
- main
1212

1313
env:
1414
REGISTRY: ghcr.io
1515
IMAGE_NAME: ${{ github.repository }}
1616

1717
jobs:
18-
build:
18+
build-docker:
1919
runs-on: ubuntu-latest
2020

2121
permissions:
@@ -47,3 +47,18 @@ jobs:
4747
push: ${{ github.event_name != 'pull_request' }}
4848
tags: ${{ steps.meta.outputs.tags }}
4949
labels: ${{ steps.meta.outputs.labels }}
50+
51+
golangci-lint:
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Set up Go
57+
uses: actions/setup-go@v5
58+
with:
59+
go-version: "1.22.x"
60+
61+
- uses: golangci/golangci-lint-action@v4.0.0
62+
with:
63+
version: latest
64+
args: --verbose

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ build:
88
GOOS=darwin GOARCH=amd64 go build -o build/kube-power_darwin_amd64
99
GOOS=darwin GOARCH=amd64 go build -o build/kube-power_darwin_arm64
1010

11+
build-docker:
12+
docker build -t kube-power .
13+
1114
clean:
1215
go clean
1316
rm -rf build

pkg/controller/controller_ceph.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package controller
22

33
import (
44
"bytes"
5+
"context"
56
"errors"
67
"slices"
78
"strings"
@@ -100,7 +101,7 @@ func (c *Controller) execPodCommand(pod *corev1.Pod, command string) (stdout, st
100101
stderrBuffer := &bytes.Buffer{}
101102
stdoutBuffer := &bytes.Buffer{}
102103

103-
err = exec.Stream(remotecommand.StreamOptions{
104+
err = exec.StreamWithContext(context.TODO(), remotecommand.StreamOptions{
104105
Stderr: stderrBuffer,
105106
Stdout: stdoutBuffer,
106107
})

0 commit comments

Comments
 (0)