Skip to content

Commit

Permalink
lint: reduce go vet/golint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
olt committed Oct 26, 2018
1 parent e837cd8 commit 7571820
Show file tree
Hide file tree
Showing 13 changed files with 95 additions and 93 deletions.
12 changes: 6 additions & 6 deletions cmd/imposm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,22 @@ func Main(usage func()) {
switch os.Args[1] {
case "import":
opts := config.ParseImport(os.Args[2:])
if opts.Base.Httpprofile != "" {
stats.StartHttpPProf(opts.Base.Httpprofile)
if opts.Base.HTTPProfile != "" {
stats.StartHTTPPProf(opts.Base.HTTPProfile)
}
import_.Import(opts)
case "diff":
opts, files := config.ParseDiffImport(os.Args[2:])

if opts.Httpprofile != "" {
stats.StartHttpPProf(opts.Httpprofile)
if opts.HTTPProfile != "" {
stats.StartHTTPPProf(opts.HTTPProfile)
}
update.Diff(opts, files)
case "run":
opts := config.ParseRunImport(os.Args[2:])

if opts.Httpprofile != "" {
stats.StartHttpPProf(opts.Httpprofile)
if opts.HTTPProfile != "" {
stats.StartHTTPPProf(opts.HTTPProfile)
}
update.Run(opts)
case "query-cache":
Expand Down
10 changes: 5 additions & 5 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Config struct {
Schemas Schemas `json:"schemas"`
ExpireTilesDir string `json:"expiretiles_dir"`
ExpireTilesZoom int `json:"expiretiles_zoom"`
ReplicationUrl string `json:"replication_url"`
ReplicationURL string `json:"replication_url"`
ReplicationInterval MinutesInterval `json:"replication_interval"`
DiffStateBefore MinutesInterval `json:"diff_state_before"`
}
Expand All @@ -48,12 +48,12 @@ type Base struct {
LimitTo string
LimitToCacheBuffer float64
ConfigFile string
Httpprofile string
HTTPProfile string
Quiet bool
Schemas Schemas
ExpireTilesDir string
ExpireTilesZoom int
ReplicationUrl string
ReplicationURL string
ReplicationInterval time.Duration
DiffStateBefore time.Duration
}
Expand Down Expand Up @@ -129,7 +129,7 @@ func (o *Base) updateFromConfig() error {
if o.ReplicationInterval < time.Minute {
o.ReplicationInterval = time.Minute
}
o.ReplicationUrl = conf.ReplicationUrl
o.ReplicationURL = conf.ReplicationURL

if o.DiffDir == "" {
if conf.DiffDir == "" {
Expand Down Expand Up @@ -179,7 +179,7 @@ func addBaseFlags(opts *Base, flags *flag.FlagSet) {
flags.StringVar(&opts.LimitTo, "limitto", "", "limit to geometries")
flags.Float64Var(&opts.LimitToCacheBuffer, "limittocachebuffer", 0.0, "limit to buffer for cache")
flags.StringVar(&opts.ConfigFile, "config", "", "config (json)")
flags.StringVar(&opts.Httpprofile, "httpprofile", "", "bind address for profile server")
flags.StringVar(&opts.HTTPProfile, "httpprofile", "", "bind address for profile server")
flags.BoolVar(&opts.Quiet, "quiet", false, "quiet log output")
flags.StringVar(&opts.Schemas.Import, "dbschema-import", defaultSchemaImport, "db schema for imports")
flags.StringVar(&opts.Schemas.Production, "dbschema-production", defaultSchemaProduction, "db schema for production")
Expand Down
2 changes: 1 addition & 1 deletion database/postgis/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func NewGeneralizedTableSpec(pg *PostGIS, t *config.GeneralizedTable) *Generaliz
FullName: pg.Prefix + t.Name,
Schema: pg.Config.ImportSchema,
Tolerance: t.Tolerance,
Where: t.SqlFilter,
Where: t.SQLFilter,
SourceName: t.SourceTableName,
}
return &spec
Expand Down
4 changes: 2 additions & 2 deletions expire/tilelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var mercRes [20]float64
func init() {
res := 2 * 20037508.342789244 / 256

for i, _ := range mercRes {
for i := range mercRes {
mercRes[i] = res
res /= 2
}
Expand Down Expand Up @@ -135,7 +135,7 @@ func (tl *TileList) expireBox(b bbox) {
}

func (tl *TileList) writeTiles(w io.Writer) error {
for tileKey, _ := range tl.tiles {
for tileKey := range tl.tiles {
_, err := fmt.Fprintf(w, "%d/%d/%d\n", tl.zoom, tileKey.X, tileKey.Y)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion expire/tilelist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestTileList_ExpireNodes(t *testing.T) {
tl.ExpireNodes(test.nodes, test.polygon)
if len(tl.tiles) != test.expected {
t.Errorf("expected %d tiles, got %d", test.expected, len(tl.tiles))
for tk, _ := range tl.tiles {
for tk := range tl.tiles {
t.Errorf("\t%v", tk)
}
}
Expand Down
2 changes: 1 addition & 1 deletion import_/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func Import(importOpts config.Import) {
osmCache.Close()
step()
if importOpts.Diff {
diffstate, err := estimateFromPBF(importOpts.Read, baseOpts.DiffStateBefore, baseOpts.ReplicationUrl, baseOpts.ReplicationInterval)
diffstate, err := estimateFromPBF(importOpts.Read, baseOpts.DiffStateBefore, baseOpts.ReplicationURL, baseOpts.ReplicationInterval)
if err != nil {
log.Println("[error] parsing diff state form PBF", err)
} else if diffstate != nil {
Expand Down
2 changes: 1 addition & 1 deletion mapping/columns.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func MakeSuffixReplace(columnName string, columnType ColumnType, column config.C
strChanges[k.(string)] = v.(string)
}
var suffixes []string
for k, _ := range strChanges {
for k := range strChanges {
suffixes = append(suffixes, k)
}
reStr := `(` + strings.Join(suffixes, "|") + `)\b`
Expand Down
4 changes: 2 additions & 2 deletions mapping/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type GeneralizedTable struct {
Name string
SourceTableName string `yaml:"source"`
Tolerance float64 `yaml:"tolerance"`
SqlFilter string `yaml:"sql_filter"`
SQLFilter string `yaml:"sql_filter"`
}

type Filters struct {
Expand Down Expand Up @@ -101,7 +101,7 @@ func (kv *KeyValues) UnmarshalYAML(unmarshal func(interface{}) error) error {
} else {
return fmt.Errorf("mapping value '%s' not a string", v)
}
order += 1
order++
}
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion stats/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/omniscale/imposm3/log"
)

func StartHttpPProf(bind string) {
func StartHTTPPProf(bind string) {
go func() {
log.Println(http.ListenAndServe(bind, nil))
}()
Expand Down
2 changes: 1 addition & 1 deletion stats/memprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func MemProfiler(dir string, interval time.Duration) {

ticker := time.NewTicker(interval)
i := 0
for _ = range ticker.C {
for range ticker.C {
filename := path.Join(
dir,
fmt.Sprintf("memprof-%03d.pprof", i),
Expand Down
2 changes: 1 addition & 1 deletion test/expire_tiles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func TestExpireTiles(t *testing.T) {
if len(tiles) > 0 {
t.Errorf("found %d unexpected tiles", len(tiles))
}
for tile, _ := range tiles {
for tile := range tiles {
t.Errorf("unexpected tile expired: %v", tile)
}
})
Expand Down
Loading

0 comments on commit 7571820

Please sign in to comment.