mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Add missing tools.go
Also rearrange the code to be more consistent. Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
parent
b9f824e617
commit
ac16ef8f0e
|
@ -16,7 +16,7 @@ jobs:
|
|||
steps:
|
||||
- checkout
|
||||
- run: make promu
|
||||
- run: make check_license staticcheck style unused build
|
||||
- run: make check_license style unused staticcheck build
|
||||
- run: git diff --exit-code
|
||||
- store_artifacts:
|
||||
path: prometheus
|
||||
|
|
|
@ -10,5 +10,5 @@ go:
|
|||
go_import_path: github.com/prometheus/prometheus
|
||||
|
||||
script:
|
||||
- make check_license staticcheck style unused test
|
||||
- make check_license style unused test staticcheck
|
||||
- git diff --exit-code
|
||||
|
|
|
@ -45,7 +45,6 @@ $(warning Some recipes may not work as expected as the current Go runtime is '$(
|
|||
else
|
||||
# This repository isn't using Go modules (yet).
|
||||
GOVENDOR := $(FIRST_GOPATH)/bin/govendor
|
||||
STATICCHECK := $(FIRST_GOPATH)/bin/staticcheck
|
||||
GO111MODULE := auto
|
||||
endif
|
||||
PROMU := $(FIRST_GOPATH)/bin/promu
|
||||
|
@ -108,16 +107,15 @@ common-vet:
|
|||
.PHONY: common-staticcheck
|
||||
common-staticcheck: $(STATICCHECK)
|
||||
@echo ">> running staticcheck"
|
||||
ifdef STATICCHECK
|
||||
GO111MODULE=off $(STATICCHECK) -ignore "$(STATICCHECK_IGNORE)" $(pkgs)
|
||||
ifeq (,$(wildcard go.mod))
|
||||
$(STATICCHECK) -ignore "$(STATICCHECK_IGNORE)" $(pkgs)
|
||||
else
|
||||
GO111MODULE=$(GO111MODULE) $(GO) install -v $(GOOPTS) honnef.co/go/tools/cmd/staticcheck
|
||||
$(FIRST_GOPATH)/bin/staticcheck -ignore "$(STATICCHECK_IGNORE)" -checks "SA*" $(pkgs)
|
||||
GO111MODULE=$(GO111MODULE) $(GO) run $(GOOPTS) honnef.co/go/tools/cmd/staticcheck -ignore "$(STATICCHECK_IGNORE)" -checks "SA*" $(pkgs)
|
||||
endif
|
||||
|
||||
.PHONY: common-unused
|
||||
common-unused: $(GOVENDOR)
|
||||
ifdef GOVENDOR
|
||||
ifeq (,$(wildcard go.mod))
|
||||
@echo ">> running check for unused packages"
|
||||
@$(GOVENDOR) list +unused | grep . && exit 1 || echo 'No unused packages'
|
||||
else
|
||||
|
@ -155,7 +153,7 @@ common-docker-tag-latest:
|
|||
promu:
|
||||
GOOS= GOARCH= GO111MODULE=off $(GO) get -u github.com/prometheus/promu
|
||||
|
||||
ifneq (,$(wildcard go.mod))
|
||||
ifeq (,$(wildcard go.mod))
|
||||
.PHONY: $(STATICCHECK)
|
||||
$(STATICCHECK):
|
||||
GOOS= GOARCH= GO111MODULE=off $(GO) get -u honnef.co/go/tools/cmd/staticcheck
|
||||
|
|
24
util/tools/tools.go
Normal file
24
util/tools/tools.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2018 The Prometheus Authors
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Imports of tools we want "go mod vendor" to include.
|
||||
// https://github.com/golang/go/issues/25624#issuecomment-395556484
|
||||
// https://github.com/golang/go/issues/25922
|
||||
|
||||
// +build tools
|
||||
|
||||
package tools
|
||||
|
||||
import (
|
||||
_ "honnef.co/go/tools/cmd/staticcheck"
|
||||
)
|
Loading…
Reference in a new issue