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

Update build #258

Merged
merged 5 commits into from
Jul 16, 2024
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
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2.1
executors:
golang:
docker:
- image: cimg/go:1.18
- image: cimg/go:1.22
jobs:
test:
executor: golang
Expand Down Expand Up @@ -104,4 +104,4 @@ workflows:
tags:
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
orbs:
prometheus: prometheus/prometheus@0.11.0
prometheus: prometheus/prometheus@0.17.1
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: daily
interval: monthly
open-pull-requests-limit: 10
ignore:
- dependency-name: github.com/prometheus/common
Expand Down
41 changes: 29 additions & 12 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,39 @@
---
# This action is synced from https://github.com/prometheus/prometheus
name: golangci-lint
on:
push:
tags:
- v*
branches:
- master
paths:
- "go.sum"
- "go.mod"
- "**.go"
- "scripts/errcheck_excludes.txt"
- ".github/workflows/golangci-lint.yml"
- ".golangci.yml"
pull_request:

permissions: # added using https://github.com/step-security/secure-repo
contents: read

jobs:
golangci:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Install Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.29
only_new_issues: true
# Optional: golangci-lint command line arguments.
# args: ./the-only-dir-to-analyze/...
go-version: 1.22.x
- name: Install snmp_exporter/generator dependencies
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
if: github.repository == 'prometheus/snmp_exporter'
- name: Lint
uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1
with:
args: --verbose
version: v1.59.1
21 changes: 9 additions & 12 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,46 @@ linters:
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- errcheck
- funlen
- gochecknoinits
- goconst
- gocritic
- gocyclo
- gofmt
- goimports
- golint
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- interfacer
- misspell
- nakedret
- nolintlint
- rowserrcheck
- scopelint
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace
- asciicheck
- gochecknoglobals
- gocognit
- godot
- godox
- maligned
- prealloc
# don't enable:
# - testpackage
# - wsl
# - lll
# - gomnd
# - nestif
# - goerr113
# - goerr113
#
linters-settings:
depguard:
rules:
main:
deny:
- pkg: "golang.org/x/exp/slices"
desc: "Use 'slices' instead."
4 changes: 4 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ builds:
goarm:
- 7

ignore:
- goos: windows
goarch: arm
goarm: 7

archives:
checksum:
Expand Down
4 changes: 2 additions & 2 deletions cmd/promql-langserver/promql-langserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"os"
"time"

kitlog "github.com/go-kit/kit/log"
kitlog "github.com/go-kit/log"
"github.com/prometheus-community/promql-langserver/config"
promClient "github.com/prometheus-community/promql-langserver/prometheus"
"github.com/prometheus/common/route"
Expand Down Expand Up @@ -70,7 +70,7 @@ func main() {
// register the different route
api.Register(router, "")
// start the http server
err = http.ListenAndServe(fmt.Sprint(":", conf.RESTAPIPort), router)
err = http.ListenAndServe(fmt.Sprint(":", conf.RESTAPIPort), router) //nolint: gosec
if err != nil {
log.Fatal(err)
}
Expand Down
5 changes: 2 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ package config

import (
"fmt"
"io/ioutil"
"net/url"
"os"
"strconv"
Expand All @@ -38,7 +37,7 @@ func ReadConfig(configFile string) (*Config, error) {
}

func readConfigFromYAML(configFile string) (*Config, error) {
b, err := ioutil.ReadFile(configFile)
b, err := os.ReadFile(configFile)
if err != nil {
return nil, err
}
Expand All @@ -63,7 +62,7 @@ const (
TextFormat LogFormat = "text"
)

var mapLogFormat = map[LogFormat]bool{ // nolint: gochecknoglobals
var mapLogFormat = map[LogFormat]bool{ //nolint: gochecknoglobals
JSONFormat: true,
TextFormat: true,
}
Expand Down
2 changes: 0 additions & 2 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ func TestUnmarshalENV(t *testing.T) {
},
}
for _, testSuite := range testSuites {
// nolint
t.Run(testSuite.title, func(t *testing.T) {
os.Clearenv()
// nolint
for k, v := range testSuite.variables {
os.Setenv(k, v)
}
Expand Down
37 changes: 29 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,20 +1,41 @@
module github.com/prometheus-community/promql-langserver

go 1.13
go 1.21

require (
github.com/blang/semver v3.5.1+incompatible
github.com/go-kit/kit v0.12.0
github.com/google/uuid v1.3.0
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/go-kit/log v0.2.1
github.com/google/uuid v1.6.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.12.2
github.com/prometheus/common v0.35.0
github.com/prometheus/prometheus v0.36.2
github.com/prometheus/client_golang v1.19.1
github.com/prometheus/common v0.54.0
github.com/prometheus/prometheus v0.47.2
github.com/rakyll/statik v0.1.7
github.com/sahilm/fuzzy v0.1.0
github.com/stretchr/testify v1.8.0
github.com/stretchr/testify v1.9.0
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dennwc/varint v1.0.0 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/julienschmidt/httprouter v1.3.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect
golang.org/x/sys v0.21.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
)
Loading