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
5 changes: 5 additions & 0 deletions .envrc.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
set -a

use nix
mkdir -p "${TMPDIR}" 2>/dev/null || true
10 changes: 10 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
- package-ecosystem: cargo
directory: /
schedule:
interval: daily
32 changes: 13 additions & 19 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.0.2
- uses: actions/checkout@v5
with:
set-safe-directory: true
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.0
- uses: actions/setup-go@v5
- name: Install Deps
run: |
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.4.0
pip install pre-commit
pre-commit run --all-files
test:
name: test
runs-on: ubuntu-latest
Expand All @@ -26,7 +31,7 @@ jobs:
- name: Install git
run: apk add --update --no-cache git
- name: Checkout code
uses: actions/checkout@v3.0.2
uses: actions/checkout@v5
with:
fetch-depth: 0
set-safe-directory: true
Expand All @@ -53,7 +58,7 @@ jobs:
- name: Install git
run: apk add --update --no-cache git
- name: Checkout
uses: actions/checkout@v3.0.2
uses: actions/checkout@v5
with:
fetch-depth: 0
set-safe-directory: true
Expand All @@ -79,26 +84,15 @@ jobs:
tag_name: ${{ steps.get_tag.outputs.git_tag }}
steps:
- name: Checkout
uses: actions/checkout@v3.0.2
uses: actions/checkout@v5
with:
fetch-depth: 0
set-safe-directory: true
- name: Generate a changelog
uses: orhun/git-cliff-action@v4
id: git-cliff
with:
config: cliff.toml
args: --verbose --latest
env:
OUTPUT: changelog.md
- name: Get the tag
id: get_tag
run: echo ::set-output name=git_tag::${GITHUB_REF/refs\/tags\//}
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1.14.0
uses: ncipollo/release-action@v1.18.0
with:
bodyFile: ./changelog.md
generateReleaseNotes: true
release-artifacts:
name: Release Artifacts
needs:
Expand All @@ -118,7 +112,7 @@ jobs:
suffix: .exe
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v5
with:
name: infinity-dialog-${{ matrix.os }}-${{ matrix.arch }}
- name: Upload Release Asset - ${{ matrix.os }}-${{ matrix.arch }}
Expand Down
266 changes: 266 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
formatters:
enable:
- gofumpt
- goimports

settings:
gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true

gofumpt:
# Choose whether to use the extra rules
extra-rules: true

goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes:
- go.opentelemetry.io/collector

issues:
# Maximum issues count per one linter.
max-issues-per-linter: 0
# Maximum count of issues with the same text.
max-same-issues: 0

linters:
enable:
- asasalint
- contextcheck
- copyloopvar
- decorder
- depguard
- errcheck
- errorlint
- fatcontext
- gocritic
- gosec
- govet
- misspell
- nolintlint
- perfsprint
- revive
- staticcheck
- testifylint
- thelper
- unconvert
- unparam
- unused
- usestdlibvars
- usetesting
- whitespace

exclusions:
presets:
- std-error-handling

# Excluding configuration per-path, per-linter, per-text and per-source
rules: []

# Log a warning if an exclusion rule is unused.
warn-unused: true

# all available settings of specific linters
settings:
depguard:
rules:
denied-deps:
deny:
- pkg: "go.uber.org/atomic"
desc: "Use 'sync/atomic' instead of go.uber.org/atomic"
- pkg: "github.com/pkg/errors"
desc: "Use 'errors' or 'fmt' instead of github.com/pkg/errors"
- pkg: "github.com/hashicorp/go-multierror"
desc: "Use go.uber.org/multierr instead of github.com/hashicorp/go-multierror"
- pkg: "math/rand$"
desc: "Use the newer 'math/rand/v2' instead of math/rand"
- pkg: "sigs.k8s.io/yaml"
desc: "Use 'go.yaml.in/yaml' instead of sigs.k8s.io/yaml"
# Add a different guard rule so that we can ignore tests.
ignore-in-test:
# Allow in tests for testing pdata or other receivers/exporters that expect OTLP.
files:
- '!**/*_test.go'
deny:
- pkg: go.opentelemetry.io/proto
desc: Use go.opentelemetry.io/collector/pdata instead

gocritic:
disabled-checks:
- commentedOutCode
- deferInLoop
- filepathJoin
- hugeParam
- importShadow
- rangeValCopy
- unnamedResult
- whyNoLint
enable-all: true

gosec:
excludes:
- G104 # FIXME
- G402
- G404

govet:
disable:
# We want to order fields according to readability and grouping them by use cases.
# This linter does not offer a discernible performance improvement as the structs
# defined in this repository are not in the execution hot path.
# See https://github.com/open-telemetry/opentelemetry-collector/issues/2789
- fieldalignment
enable-all: true
# settings per analyzer
settings:
printf: # analyzer name, run `go tool vet help` to see all analyzers
funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer
- Infof
- Warnf
- Errorf
- Fatalf

misspell:
# Correct spellings using locale preferences for US or UK.
# Default is to use a neutral variety of English.
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
locale: US
ignore-rules:
- cancelled

nolintlint:
require-specific: true

perfsprint:
# Optimizes even if it requires an int or uint type cast.
int-conversion: true
# Optimizes into `err.Error()` even if it is only equivalent for non-nil errors.
err-error: true
# Optimizes `fmt.Errorf`.
errorf: true
# Optimizes `fmt.Sprintf` with only one argument.
sprintf1: true
# Optimizes into strings concatenation.
strconcat: true

revive:
# minimal confidence for issues, default is 0.8
confidence: 0.8
rules:
# Blank import should be only in a main or test package, or have a comment justifying it.
- name: blank-imports
# context.Context() should be the first parameter of a function when provided as argument.
- name: context-as-argument
# Basic types should not be used as a key in `context.WithValue`
- name: context-keys-type
# Importing with `.` makes the programs much harder to understand
- name: dot-imports
- name: early-return
arguments:
- preserveScope
# Empty blocks make code less readable and could be a symptom of a bug or unfinished refactoring.
- name: empty-block
# for better readability, variables of type `error` must be named with the prefix `err`.
- name: error-naming
# for better readability, the errors should be last in the list of returned values by a function.
- name: error-return
# for better readability, error messages should not be capitalized or end with punctuation or a newline.
- name: error-strings
# report when replacing `errors.New(fmt.Sprintf())` with `fmt.Errorf()` is possible
- name: errorf
# incrementing an integer variable by 1 is recommended to be done using the `++` operator
- name: increment-decrement
# highlights redundant else-blocks that can be eliminated from the code
- name: indent-error-flow
# This rule suggests a shorter way of writing ranges that do not use the second value.
- name: range
# receiver names in a method should reflect the struct name (p for Person, for example)
- name: receiver-naming
# redefining built in names (true, false, append, make) can lead to bugs very difficult to detect.
- name: redefines-builtin-id
# redundant else-blocks that can be eliminated from the code.
- name: superfluous-else
arguments:
- preserveScope
# prevent confusing name for variables when using `time` package
- name: time-naming
# warns when an exported function or method returns a value of an un-exported type.
- name: unexported-return
- name: unnecessary-stmt
# spots and proposes to remove unreachable code. also helps to spot errors
- name: unreachable-code
# Functions or methods with unused parameters can be a symptom of an unfinished refactoring or a bug.
- name: unused-parameter
# Since Go 1.18, interface{} has an alias: any. This rule proposes to replace instances of interface{} with any.
- name: use-any
# report when a variable declaration can be simplified
- name: var-declaration
# warns when initialism, variable or package naming conventions are not followed.
- name: var-naming

staticcheck:
checks:
- all
- -ST1000
- -ST1021
- -ST1022

testifylint:
enable-all: true

thelper:
benchmark:
begin: false
fuzz:
begin: false
tb:
begin: false
test:
begin: false

# output configuration options
output:
# The formats used to render issues.
formats:
# Prints issues in a text format with colors, line number, and linter name.
text:
# Output path can be either `stdout`, `stderr` or path to the file to write to.
path: stdout
# print linter name in the end of issue text, default is true
print-linter-name: true
# print lines of code with issue, default is true
print-issued-lines: true

# Show statistics per linter.
show-stats: false

# options for analysis running
run:
# Allow multiple parallel golangci-lint instances running.
# If false (default) - golangci-lint acquires file lock on start.
allow-parallel-runners: true

# default concurrency is a available CPU number
concurrency: 4

# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
# to go.mod are needed. This setting is most useful to check that go.mod does
# not need updates, such as in a continuous integration and testing system.
# If invoked with -mod=vendor, the go command assumes that the vendor
# directory holds the correct copies of dependencies and ignores
# the dependency descriptions in go.mod.
modules-download-mode: readonly

# exit code when at least one issue was found, default is 1
issues-exit-code: 1

# include test files or not, default is true
tests: true

# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 10m

version: "2"
3 changes: 2 additions & 1 deletion .mise.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[tools]
go = "1.23"
go = "1.25"
golangci-lint = "latest"
Loading