Skip to content

Commit

Permalink
chore: add goimports
Browse files Browse the repository at this point in the history
  • Loading branch information
lesam committed Jan 29, 2021
1 parent 06020b2 commit b4520c7
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ ui_client:
#

fmt: $(SOURCES_NO_VENDOR)
gofmt -w -s $^
./etc/fmt.sh

checkfmt:
./etc/checkfmt.sh
Expand Down
2 changes: 1 addition & 1 deletion chronograf/dist/dist.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"net/http"

"github.com/elazarl/go-bindata-assetfs"
assetfs "github.com/elazarl/go-bindata-assetfs"
)

// DebugAssets serves assets via a specified directory
Expand Down
2 changes: 1 addition & 1 deletion cmd/internal/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package internal
import (
"errors"
"fmt"
"github.com/influxdata/influxdb/v2/task/options"
"os"
"strings"
"time"

"github.com/influxdata/influxdb/v2/task/options"
"github.com/tcnksm/go-input"
)

Expand Down
4 changes: 2 additions & 2 deletions etc/checkfmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ HAS_FMT_ERR=0
for file in $(go list -f '{{$dir := .Dir}}{{range .GoFiles}}{{printf "%s/%s\n" $dir .}}{{end}}' ./...); do
# ... if file does not contain standard generated code comment (https://golang.org/s/generatedcode)...
if ! grep -Exq '^// Code generated .* DO NOT EDIT\.$' $file; then
FMT_OUT="$(gofmt -l -d -e $file)" # gofmt exits 0 regardless of whether it's formatted.
# ... and if gofmt had any output...
FMT_OUT="$(goimports -l -d $file)"
# ... and if goimports had any output...
if [[ -n "$FMT_OUT" ]]; then
if [ "$HAS_FMT_ERR" -eq "0" ]; then
# Only print this once.
Expand Down
10 changes: 10 additions & 0 deletions etc/fmt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# For every Go file in the project, excluding vendor...
for file in $(go list -f '{{$dir := .Dir}}{{range .GoFiles}}{{printf "%s/%s\n" $dir .}}{{end}}' ./...); do
# ... if file does not contain standard generated code comment (https://golang.org/s/generatedcode)...
if ! grep -Exq '^// Code generated .* DO NOT EDIT\.$' $file; then
gofmt -w -s $file
goimports -w $file
fi
done
1 change: 0 additions & 1 deletion http/backup_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

"github.com/influxdata/httprouter"
"github.com/influxdata/influxdb/v2"
// "github.com/influxdata/influxdb/v2/bolt"
"github.com/influxdata/influxdb/v2/kit/tracing"
"go.uber.org/zap"
)
Expand Down
2 changes: 1 addition & 1 deletion logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io"
"time"

"github.com/jsternberg/zap-logfmt"
zaplogfmt "github.com/jsternberg/zap-logfmt"
isatty "github.com/mattn/go-isatty"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
Expand Down
2 changes: 1 addition & 1 deletion task/backend/analytical_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/influxdata/influxdb/v2/kit/errors"
"time"

"github.com/influxdata/flux"
"github.com/influxdata/flux/lang"
"github.com/influxdata/influxdb/v2"
"github.com/influxdata/influxdb/v2/kit/errors"
"github.com/influxdata/influxdb/v2/query"
"github.com/influxdata/influxdb/v2/storage"
"go.uber.org/zap"
Expand Down
1 change: 1 addition & 0 deletions tenant/service_onboarding.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package tenant
import (
"context"
"fmt"

"github.com/influxdata/influxdb/v2"
icontext "github.com/influxdata/influxdb/v2/context"
"github.com/influxdata/influxdb/v2/kv"
Expand Down
2 changes: 1 addition & 1 deletion tsdb/index/tsi1/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (c *TagValueSeriesIDCache) Put(name, key, value []byte, ss *tsdb.SeriesIDSe

// No map for the measurement - first tag key for the measurement.
c.cache[string(name)] = map[string]map[string]*list.Element{
string(key): map[string]*list.Element{string(value): listElement},
string(key): {string(value): listElement},
}

EVICT:
Expand Down

0 comments on commit b4520c7

Please sign in to comment.