Skip to content
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
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ M = $(shell printf "\033[34;1m🐱\033[0m")
TIMEOUT_UNIT = 5m
TIMEOUT_E2E = 20m

# Get golangci_version from tools/go.mod to eliminate the manual bump
GOLANGCI_VERSION = $(shell cat tools/go.mod | grep golangci-lint | awk '{ print $$3 }')
# Get golangci version from workflow to match CI; fallback to tools/go.mod
GOLANGCI_VERSION = $(or $(shell yq '.jobs.linting.steps[] | select(.name == "golangci-lint") | .with.version' .github/workflows/ci.yaml 2>/dev/null),$(shell grep 'golangci/golangci-lint/v2' tools/go.mod | awk '{print $$3}'))

YAML_FILES := $(shell find . -type f -regex ".*y[a]ml" -print)

Expand Down Expand Up @@ -96,14 +96,14 @@ test: test-unit ## run all tests
.PHONY: lint
lint: lint-go goimports lint-yaml ## run all linters

GOLANGCILINT = $(BIN)/golangci-lint
GOLANGCILINT = $(or $(GOLANGCILINT_BIN),$(BIN)/golangci-lint)
$(BIN)/golangci-lint: ; $(info $(M) getting golangci-lint $(GOLANGCI_VERSION))
cd tools; GOBIN=$(BIN) $(GO) install -mod=mod github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_VERSION)
@mkdir -p $(BIN)
GOTOOLCHAIN=go$$(grep '^go ' go.mod | awk '{print $$2}') GOBIN=$(BIN) $(GO) install -mod=mod github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_VERSION)

.PHONY: lint-go
lint-go: | $(GOLANGCILINT) ; $(info $(M) running golangci-lint…) @ ## Run golangci-lint
$Q $(GOLANGCILINT) run --modules-download-mode=vendor --max-issues-per-linter=0 --max-same-issues=0 --timeout 10m
@rm -f $(GOLANGCILINT)

GOIMPORTS = $(BIN)/goimports
$(GOIMPORTS): ; $(info $(M) getting goimports )
Expand Down
1 change: 1 addition & 0 deletions cmd/tkn/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func main() {
}

// if we have found the plugin then sysexec it by replacing current process.
// #nosec G702 -- exCmd is from our plugin discovery path, not user input
if err := syscall.Exec(exCmd, append([]string{exCmd}, os.Args[2:]...), os.Environ()); err != nil {
fmt.Fprintf(os.Stderr, "Command finished with error: %v", err)
os.Exit(127)
Expand Down
2 changes: 2 additions & 0 deletions pkg/cmd/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//nolint:revive // package name matches stdlib by design
package version

import (
Expand Down Expand Up @@ -216,6 +217,7 @@ func (cli *Client) getRelease(url string) (ghversion GHVersion, err error) {
return ghversion, errors.Wrap(err, "failed to fetch the latest version")
}

// #nosec G704 -- URL is from our release API, not user-controlled
res, err := cli.httpClient.Do(req)
defer func() {
err := res.Body.Close()
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/version/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package version
package version //nolint:revive

import (
"context"
Expand Down
1 change: 1 addition & 0 deletions pkg/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//nolint:revive // package name matches stdlib by design
package log

import "k8s.io/apimachinery/pkg/runtime/schema"
Expand Down
2 changes: 1 addition & 1 deletion pkg/log/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package log
package log //nolint:revive

import (
"fmt"
Expand Down
1 change: 1 addition & 0 deletions pkg/plugins/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func GetAllTknPluginFromPaths() []string {
continue
}
fpath := filepath.Join(path, file.Name())
// #nosec G703 -- fpath is from filepath.Join with validated path
info, err := os.Stat(fpath)
if err != nil {
continue
Expand Down
2 changes: 1 addition & 1 deletion pkg/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package version
package version //nolint:revive

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/version/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package version
package version //nolint:revive

import (
"context"
Expand Down
Loading