Skip to content

Commit

Permalink
Add lint job, fix use of deprecated exec.Stream
Browse files Browse the repository at this point in the history
  • Loading branch information
ianunruh committed Oct 20, 2024
1 parent 8a2b2c1 commit 3042d7b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
1 change: 1 addition & 0 deletions .dockerignore
25 changes: 20 additions & 5 deletions .github/workflows/docker-build.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
name: Build Docker image
name: Build

on:
push:
branches:
- main
- main
tags:
- v*.*.*
- v*.*.*
pull_request:
branches:
- main
- main

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
build-docker:
runs-on: ubuntu-latest

permissions:
Expand Down Expand Up @@ -47,3 +47,18 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22.x"

- uses: golangci/[email protected]
with:
version: latest
args: --verbose
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ build:
GOOS=darwin GOARCH=amd64 go build -o build/kube-power_darwin_amd64
GOOS=darwin GOARCH=amd64 go build -o build/kube-power_darwin_arm64

build-docker:
docker build -t kube-power .

clean:
go clean
rm -rf build
Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/controller_ceph.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package controller

import (
"bytes"
"context"
"errors"
"slices"
"strings"
Expand Down Expand Up @@ -100,7 +101,7 @@ func (c *Controller) execPodCommand(pod *corev1.Pod, command string) (stdout, st
stderrBuffer := &bytes.Buffer{}
stdoutBuffer := &bytes.Buffer{}

err = exec.Stream(remotecommand.StreamOptions{
err = exec.StreamWithContext(context.TODO(), remotecommand.StreamOptions{
Stderr: stderrBuffer,
Stdout: stdoutBuffer,
})
Expand Down

0 comments on commit 3042d7b

Please sign in to comment.