Skip to content
Open
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
11 changes: 7 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
schedule:
- cron: '15 22 * * *'
workflow_dispatch: {} # support manual runs
Expand All @@ -15,7 +14,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.23.x, 1.24.x]
go-version:
- name: latest
version: 1.26.x
- name: previous
version: 1.25.x
steps:
- name: Checkout Code
uses: actions/checkout@v4
Expand All @@ -24,13 +27,13 @@ jobs:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
go-version: ${{ matrix.go-version.version }}
- name: Test
run: make test
- name: Lint
# Often, lint & gofmt guidelines depend on the Go version. To prevent
# conflicting guidance, run only on the most recent supported version.
# For the same reason, only check generated code on the most recent
# supported version.
if: matrix.go-version == '1.24.x'
if: matrix.go-version.name == 'latest'
run: make checkgenerate && make lint
104 changes: 59 additions & 45 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
linters-settings:
errcheck:
check-type-assertions: true
forbidigo:
forbid:
- '^fmt\.Print'
- '^log\.'
- '^print$'
- '^println$'
- '^panic$'
godox:
# TODO, OPT, etc. comments are fine to commit. Use FIXME comments for
# temporary hacks, and use godox to prevent committing them.
keywords: [FIXME]
varnamelen:
ignore-decls:
- T any
- i int
- wg sync.WaitGroup
- id string
version: "2"
linters:
enable-all: true
default: all
disable:
- cyclop # covered by gocyclo
- depguard # unnecessary for small libraries
Expand All @@ -28,8 +9,6 @@ linters:
- funlen # rely on code review to limit function length
- gochecknoglobals # many exceptions
- gocognit # dubious "cognitive overhead" quantification
- gofumpt # prefer standard gofmt
- goimports # rely on gci instead
- inamedparam # not standard style
- interfacebloat # many exceptions
- ireturn # "accept interfaces, return structs" isn't ironclad
Expand All @@ -43,25 +22,60 @@ linters:
- thelper # we want to print out the whole stack
- wrapcheck # don't _always_ need to wrap errors
- wsl # generous whitespace violates house style
issues:
exclude-dirs-use-default: false
exclude-rules:
- linters:
- revive
text: "error.*capitalized"
- linters:
- stylecheck
text: "error.*capitalized"
- linters:
- stylecheck
path: appcmd/appcmd.go
text: "ST1005"
- linters:
- unparam
path: appext/name_container_unix_test.go
- linters:
- varnamelen
path: app.go
- linters:
- varnamelen
path: appext/builder.go
- noinlineerr # if err := ...; err != nil is idiomatic Go
- wsl_v5 # generous whitespace violates house style
settings:
errcheck:
check-type-assertions: true
forbidigo:
forbid:
- pattern: '^fmt\.Print'
- pattern: '^log\.'
- pattern: '^print$'
- pattern: '^println$'
- pattern: '^panic$'
godox:
# TODO, OPT, etc. comments are fine to commit. Use FIXME comments for
# temporary hacks, and use godox to prevent committing them.
keywords: [FIXME]
varnamelen:
ignore-decls:
- T any
- i int
- wg sync.WaitGroup
- id string
exclusions:
rules:
- linters:
- revive
text: "error.*capitalized"
- linters:
- staticcheck
text: "error.*capitalized"
- linters:
- staticcheck
# No need to require embedded fields from selector expression.
text: "QF1008"
- linters:
- staticcheck
# Whether or not to apply De Morgan's law is contextual.
text: "QF1001"
- linters:
- gosec
# G304: reading user-specified config/secret files is expected behavior.
path: appext/appext.go
text: "G304:"
- linters:
- gosec
# G301: 0755 is appropriate for application config directories.
path: appext/appext.go
text: "G301:"
- linters:
- unparam
path: appext/name_container_unix_test.go
- linters:
- varnamelen
path: app.go
- linters:
- varnamelen
path: appext/builder.go
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ MAKEFLAGS += --no-print-directory
BIN := .tmp/bin
export PATH := $(abspath $(BIN)):$(PATH)
export GOBIN := $(abspath $(BIN))
COPYRIGHT_YEARS := 2025
COPYRIGHT_YEARS := 2025-2026
LICENSE_IGNORE := --ignore testdata/

BUF_VERSION := v1.53.0
GO_MOD_GOTOOLCHAIN := go1.24.3
GOLANGCI_LINT_VERSION := v1.64.8
# https://github.com/golangci/golangci-lint/issues/4837
GOLANGCI_LINT_GOTOOLCHAIN := $(GO_MOD_GOTOOLCHAIN)
# https://github.com/bufbuild/buf/releases
BUF_VERSION := v1.66.1
GOLANGCI_LINT_VERSION := v2.9.0
# This version is the go toolchain version (which may be more specific than the module
# version) to ensure the build handles specific language features in newer toolchains.
GOLANGCILINT_GOTOOLCHAIN_VERSION := $(shell go env GOVERSION | sed 's/^go//')
#GO_GET_PKGS :=

.PHONY: help
Expand Down Expand Up @@ -48,11 +49,11 @@ install: ## Install all binaries
.PHONY: lint
lint: $(BIN)/golangci-lint ## Lint
go vet ./...
GOTOOLCHAIN=$(GOLANGCI_LINT_GOTOOLCHAIN) golangci-lint run --modules-download-mode=readonly --timeout=3m0s
GOTOOLCHAIN=go$(GOLANGCILINT_GOTOOLCHAIN_VERSION) golangci-lint run --modules-download-mode=readonly --timeout=3m0s

.PHONY: lintfix
lintfix: $(BIN)/golangci-lint ## Automatically fix some lint errors
GOTOOLCHAIN=$(GOLANGCI_LINT_GOTOOLCHAIN) golangci-lint run --fix --modules-download-mode=readonly --timeout=3m0s
GOTOOLCHAIN=go$(GOLANGCILINT_GOTOOLCHAIN_VERSION) golangci-lint run --fix --modules-download-mode=readonly --timeout=3m0s

.PHONY: generate
generate: $(BIN)/license-header ## Regenerate code and licenses
Expand All @@ -63,7 +64,6 @@ generate: $(BIN)/license-header ## Regenerate code and licenses

.PHONY: upgrade
upgrade: ## Upgrade dependencies
go mod edit -toolchain=$(GO_MOD_GOTOOLCHAIN)
go get -u -t ./... $(GO_GET_PKGS)
go mod tidy -v

Expand All @@ -78,4 +78,4 @@ $(BIN)/license-header: Makefile

$(BIN)/golangci-lint: Makefile
@mkdir -p $(@D)
GOTOOLCHAIN=$(GOLANGCI_LINT_GOTOOLCHAIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
GOTOOLCHAIN=go$(GOLANGCILINT_GOTOOLCHAIN_VERSION) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
2 changes: 1 addition & 1 deletion app.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app_error.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app_unix.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion app_windows.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
6 changes: 3 additions & 3 deletions appcmd/appcmd.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -330,9 +330,9 @@ func commandToCobra(
cobraCommand.Run = func(_ *cobra.Command, args []string) {
printUsage(container, cobraCommand.UsageString())
if len(args) == 0 {
*runErrAddr = errors.New("Sub-command required.")
*runErrAddr = errors.New("sub-command required")
} else {
*runErrAddr = fmt.Errorf("Unknown sub-command: %s", strings.Join(args, " "))
*runErrAddr = fmt.Errorf("unknown sub-command: %s", strings.Join(args, " "))
Comment on lines -333 to +335
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if we feel strongly about keeping these?

}
}
for _, subCommand := range command.SubCommands {
Expand Down
2 changes: 1 addition & 1 deletion appcmd/appcmd_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
6 changes: 3 additions & 3 deletions appcmd/appcmdtesting/appcmdtesting.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -176,7 +176,7 @@ func WithStdout(stdout io.Writer) RunOption {
}
}

// WithStdout will attach the given stderr to write to.
// WithStderr will attach the given stderr to write to.
func WithStderr(stderr io.Writer) RunOption {
return func(runOptions *runOptions) {
runOptions.stderr = stderr
Expand All @@ -200,7 +200,7 @@ func WithExpectedStdout(expectedStdout string) RunOption {
}
}

// WithExpectedStdout will result in an error if the stderr does not exactly equal the given string.
// WithExpectedStderr will result in an error if the stderr does not exactly equal the given string.
//
// Note that this can be called with empty, which will result in Run verifying that the stderr is empty.
func WithExpectedStderr(expectedStderr string) RunOption {
Expand Down
2 changes: 1 addition & 1 deletion appcmd/cobra.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion appcmd/invalid_argument_error.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion appcmd/positional_args.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion appext/appext.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion appext/builder.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion appext/container.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion appext/log_format.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion appext/log_level.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion appext/logger_container.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion appext/name_container.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion appext/name_container_unix_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion arg_container.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion container.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion discard_reader.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion env_container.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module buf.build/go/app

go 1.23.0

toolchain go1.24.3
go 1.25.0

require (
buf.build/go/interrupt v1.1.0
Expand Down
2 changes: 1 addition & 1 deletion locked_writer.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion stderr_container.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2025 Buf Technologies, Inc.
// Copyright 2025-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Loading
Loading