Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Switch to OpenSLO SDK #341

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
85 changes: 25 additions & 60 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,107 +1,78 @@
run:
timeout: 5m
modules-download-mode: readonly
go: "1.20"
skip-dirs-use-default: true

issues:
# Enable all checks (which was as default disabled e.g. comments).
exclude-use-default: false

exclude-rules:
# Documenting comments are not required except on packages.
- linters:
- golint
text: exported (function|method) .*? should have comment or be unexported
- linters:
- golint
text: exported const .*? should have comment (\(or a comment on this block\) )?or be unexported
- linters:
- golint
text: exported type .*? should have comment or be unexported
# Stylecheck checks if at least one file has package comment but it's not required on all of them.
- revive
text: exported (function|method|type) .*? should have comment or be unexported
- linters:
- golint
text: package comment should be of the form "Package .*? ..."
- revive
text: exported (const|var) .*? should have comment (\(or a comment on this block\) )?or be unexported
- linters:
- revive
text: package-comments
text: "if-return: redundant if ...; err != nil check, just return error instead."
- linters:
- stylecheck
text: ST1000
- revive
text: "^var-naming: .*"
- linters:
- gocritic
text: whyNoLint

- revive
text: "error-strings: error strings should not be capitalized or end with punctuation or a newline"
# Value 0 means show all.
max-issues-per-linter: 0
max-same-issues: 0

linters-settings:
goimports:
# Put imports beginning with prefix after 3rd-party packages,
# it's a comma-separated list of prefixes.
local-prefixes: github.com/OpenSLO/oslo
golint:
min-confidence: 0
govet:
# Report about shadowed variables.
check-shadowing: true
# False positives and reporting on error shadowing (which is intended).
# Quoting Robi Pike:
nieomylnieja marked this conversation as resolved.
Show resolved Hide resolved
# The shadow code is marked experimental.
# It has too many false positives to be enabled by default, so this is not entirely unexpected,
# but don't expect a fix soon. The right way to detect shadowing without flow analysis is elusive.
# Few years later (comment from 2015) and the Shadow analyer is still experimental...
check-shadowing: false
lll:
line-length: 120
gocritic:
enabled-tags:
- diagnostic
- opinionated
- style
disabled-checks:
- singleCaseSwitch
exhaustive:
# In switch statement treat label default: as being exhaustive.
default-signifies-exhaustive: true
misspell:
locale: US
forbidigo:
forbid:
- ^ioutil\..*$ # Package ioutil is deprecated.
gci:
sections:
- standard # Captures all standard packages if they do not match another section.
- default # Contains all imports that could not be matched to another section type.
- prefix(github.com/OpenSLO/oslo) # Groups all imports with the specified Prefix.
gocognit:
min-complexity: 30
revive:
rules:
- name: package-comments
severity: ok
- name: unused-parameter
disabled: true

linters:
# Please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint.
disable-all: true
enable:
# All linters from list https://golangci-lint.run/usage/linters/ are specifed here and explicit enable/disable.
# All linters from list https://golangci-lint.run/usage/linters/ are speciefed here and explicit enable/disable.
nieomylnieja marked this conversation as resolved.
Show resolved Hide resolved
- asciicheck
- bodyclose
- cyclop
- dogsled
- dupl
- durationcheck
- errcheck
- errorlint
- exhaustive
- exportloopref
- forbidigo
- gci
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- gofmt
- gofumpt
- goheader
- goimports
- goprintffuncname
- gosec
- gosimple
- govet
- importas
Expand All @@ -110,19 +81,13 @@ linters:
- makezero
- misspell
- nakedret
- nestif
- nilerr
- noctx
- nolintlint
- paralleltest
- prealloc
- predeclared
- revive
- rowserrcheck
- sqlclosecheck
- staticcheck
- stylecheck
- thelper
- tparallel
- typecheck
- unconvert
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
VERSION := $(shell git describe --tags)
.PHONY: build
build:
go build -ldflags="-X 'main.version=${VERSION}'" -o bin/oslo
go build -ldflags="-X 'main.version=${VERSION}'" -o bin/oslo ./cmd/oslo/

.PHONY: install
install: run/tests build
Expand Down
Loading
Loading