build: fix makefile and CI 'fmt' and 'vet' tasks (#6937)
This commit is contained in:
parent
aad3bf98b0
commit
88d9d0fb09
|
@ -51,14 +51,17 @@ jobs:
|
||||||
- run:
|
- run:
|
||||||
name: check go fmt
|
name: check go fmt
|
||||||
command: |
|
command: |
|
||||||
files=$(go fmt ./...)
|
files="$(go fmt ./... ; (cd api && go fmt ./... | sed 's@^@api/@') ; (cd sdk && go fmt ./... | sed 's@^@sdk/@'))"
|
||||||
if [ -n "$files" ]; then
|
if [ -n "$files" ]; then
|
||||||
echo "The following file(s) do not conform to go fmt:"
|
echo "The following file(s) do not conform to go fmt:"
|
||||||
echo "$files"
|
echo "$files"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
- run:
|
- run:
|
||||||
command: go vet ./...
|
command: |
|
||||||
|
go vet ./... && \
|
||||||
|
(cd api && go vet ./...) && \
|
||||||
|
(cd sdk && go vet ./...)
|
||||||
environment:
|
environment:
|
||||||
<<: *ENVIRONMENT
|
<<: *ENVIRONMENT
|
||||||
|
|
||||||
|
|
|
@ -307,11 +307,15 @@ cover:
|
||||||
|
|
||||||
format:
|
format:
|
||||||
@echo "--> Running go fmt"
|
@echo "--> Running go fmt"
|
||||||
@go fmt $(GOFILES)
|
@go fmt ./...
|
||||||
|
@cd api && go fmt ./... | sed 's@^@api/@'
|
||||||
|
@cd sdk && go fmt ./... | sed 's@^@sdk/@'
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
@echo "--> Running go vet"
|
@echo "--> Running go vet"
|
||||||
@go vet -tags '$(GOTAGS)' $(GOFILES); if [ $$? -eq 1 ]; then \
|
@go vet -tags '$(GOTAGS)' ./... && \
|
||||||
|
(cd api && go vet -tags '$(GOTAGS)' ./...) && \
|
||||||
|
(cd sdk && go vet -tags '$(GOTAGS)' ./...); if [ $$? -ne 0 ]; then \
|
||||||
echo ""; \
|
echo ""; \
|
||||||
echo "Vet found suspicious constructs. Please check the reported constructs"; \
|
echo "Vet found suspicious constructs. Please check the reported constructs"; \
|
||||||
echo "and fix them if necessary before submitting the code for review."; \
|
echo "and fix them if necessary before submitting the code for review."; \
|
||||||
|
|
|
@ -43,7 +43,7 @@ type KVPair struct {
|
||||||
|
|
||||||
// Namespace is the namespace the KVPair is associated with
|
// Namespace is the namespace the KVPair is associated with
|
||||||
// Namespacing is a Consul Enterprise feature.
|
// Namespacing is a Consul Enterprise feature.
|
||||||
Namespace string `json: ",omitempty"`
|
Namespace string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// KVPairs is a list of KVPair objects
|
// KVPairs is a list of KVPair objects
|
||||||
|
|
|
@ -28,19 +28,19 @@ type SessionEntry struct {
|
||||||
LockDelay time.Duration
|
LockDelay time.Duration
|
||||||
Behavior string
|
Behavior string
|
||||||
TTL string
|
TTL string
|
||||||
Namespace string `json:",omitempty"`
|
Namespace string `json:",omitempty"`
|
||||||
|
|
||||||
// Deprecated for Consul Enterprise in v1.7.0.
|
// Deprecated for Consul Enterprise in v1.7.0.
|
||||||
Checks []string
|
Checks []string
|
||||||
|
|
||||||
// NodeChecks and ServiceChecks are new in Consul 1.7.0.
|
// NodeChecks and ServiceChecks are new in Consul 1.7.0.
|
||||||
// When associating checks with sessions, namespaces can be specified for service checks.
|
// When associating checks with sessions, namespaces can be specified for service checks.
|
||||||
NodeChecks []string
|
NodeChecks []string
|
||||||
ServiceChecks []ServiceCheck
|
ServiceChecks []ServiceCheck
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServiceCheck struct {
|
type ServiceCheck struct {
|
||||||
ID string
|
ID string
|
||||||
Namespace string
|
Namespace string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,12 +97,12 @@ type KVTxnResponse struct {
|
||||||
type SessionOp string
|
type SessionOp string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SessionDelete SessionOp = "delete"
|
SessionDelete SessionOp = "delete"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SessionTxnOp defines a single operation inside a transaction.
|
// SessionTxnOp defines a single operation inside a transaction.
|
||||||
type SessionTxnOp struct {
|
type SessionTxnOp struct {
|
||||||
Verb SessionOp
|
Verb SessionOp
|
||||||
Session Session
|
Session Session
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue