mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2024-12-26 21:05:00 +02:00
Run go generate
during make
and make sure that generated files are in sync in CI (#101)
* Run go generate in the precommit target So we should always get an updated version of a file generated by a stringer utility. * Update the generated file * Make CI to fail if working tree has uncommited changes The uncommitted changes may come from the golang linter (that formats our code among other things) and from stringer (when updated some enumeration).
This commit is contained in:
parent
8e7e1fd0a9
commit
8d93efab11
18
Makefile
18
Makefile
@ -19,7 +19,11 @@ $(TOOLS_DIR)/golangci-lint: go.mod go.sum tools.go
|
||||
$(TOOLS_DIR)/misspell: go.mod go.sum tools.go
|
||||
go build -o $(TOOLS_DIR)/misspell github.com/client9/misspell/cmd/misspell
|
||||
|
||||
precommit: $(TOOLS_DIR)/golangci-lint $(TOOLS_DIR)/misspell
|
||||
$(TOOLS_DIR)/stringer: go.mod go.sum tools.go
|
||||
go build -o $(TOOLS_DIR)/stringer golang.org/x/tools/cmd/stringer
|
||||
|
||||
precommit: $(TOOLS_DIR)/golangci-lint $(TOOLS_DIR)/misspell $(TOOLS_DIR)/stringer
|
||||
PATH="$(abspath $(TOOLS_DIR)):$${PATH}" go generate ./...
|
||||
$(TOOLS_DIR)/golangci-lint run --fix # TODO: Fix this on windows.
|
||||
$(TOOLS_DIR)/misspell -w $(ALL_DOCS)
|
||||
|
||||
@ -29,7 +33,17 @@ test-with-coverage:
|
||||
go tool cover -html=coverage.txt -o coverage.html
|
||||
|
||||
.PHONY: circle-ci
|
||||
circle-ci: precommit test-with-coverage test-386
|
||||
circle-ci: precommit test-clean-work-tree test-with-coverage test-386
|
||||
|
||||
.PHONY: test-clean-work-tree
|
||||
test-clean-work-tree:
|
||||
@if ! git diff --quiet; then \
|
||||
echo; \
|
||||
echo "Working tree is not clean"; \
|
||||
echo; \
|
||||
git status; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
|
@ -1,17 +1,3 @@
|
||||
// Copyright 2019, OpenTelemetry 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.
|
||||
|
||||
// Code generated by "stringer -type=EventType"; DO NOT EDIT.
|
||||
|
||||
package observer
|
||||
@ -32,11 +18,12 @@ func _() {
|
||||
_ = x[NEW_METRIC-7]
|
||||
_ = x[MODIFY_ATTR-8]
|
||||
_ = x[RECORD_STATS-9]
|
||||
_ = x[SET_STATUS-10]
|
||||
}
|
||||
|
||||
const _EventType_name = "INVALIDSTART_SPANFINISH_SPANLOG_EVENTLOGF_EVENTNEW_SCOPENEW_MEASURENEW_METRICMODIFY_ATTRRECORD_STATS"
|
||||
const _EventType_name = "INVALIDSTART_SPANFINISH_SPANADD_EVENTADD_EVENTFNEW_SCOPENEW_MEASURENEW_METRICMODIFY_ATTRRECORD_STATSSET_STATUS"
|
||||
|
||||
var _EventType_index = [...]uint8{0, 7, 17, 28, 37, 47, 56, 67, 77, 88, 100}
|
||||
var _EventType_index = [...]uint8{0, 7, 17, 28, 37, 47, 56, 67, 77, 88, 100, 110}
|
||||
|
||||
func (i EventType) String() string {
|
||||
if i < 0 || i >= EventType(len(_EventType_index)-1) {
|
||||
|
Loading…
Reference in New Issue
Block a user