Skip to content

Commit

Permalink
add go vet to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
bdon committed Jan 28, 2024
1 parent c0fb76e commit 702020a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ jobs:
with:
go-version: '^1.18.0'
- run: go test ./pmtiles
fmt:
fmt_vet_lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '^1.18.0'
- run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
- run: go vet caddy/pmtiles_proxy.go
- run: go vet main.go
- run: go vet pmtiles/*
4 changes: 2 additions & 2 deletions caddy/pmtiles_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (m *Middleware) Provision(ctx caddy.Context) error {
m.logger = ctx.Logger()
logger := log.New(io.Discard, "", log.Ldate)
prefix := "." // serve only the root of the bucket for now, at the root route of Caddyfile
server, err := pmtiles.NewServer(m.Bucket, prefix, logger, m.CacheSize, "", m.PublicUrl)
server, err := pmtiles.NewServer(m.Bucket, prefix, logger, m.CacheSize, "", m.PublicURL)
if err != nil {
return err
}
Expand Down Expand Up @@ -96,7 +96,7 @@ func (m *Middleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
}
m.CacheSize = num
case "public_url":
if !d.Args(&m.PublicUrl) {
if !d.Args(&m.PublicURL) {
return d.ArgErr()
}
}
Expand Down
22 changes: 11 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ var cli struct {
Bucket string `help:"Remote bucket of input archive."`
Region string `help:"local GeoJSON Polygon or MultiPolygon file for area of interest." type:"existingfile"`
Bbox string `help:"bbox area of interest: min_lon,min_lat,max_lon,max_lat" type:"string"`
Minzoom int8 `default:-1 help:"Minimum zoom level, inclusive."`
Maxzoom int8 `default:-1 help:"Maximum zoom level, inclusive."`
DownloadThreads int `default:4 help:"Number of download threads."`
Minzoom int8 `default:"-1" help:"Minimum zoom level, inclusive."`
Maxzoom int8 `default:"-1" help:"Maximum zoom level, inclusive."`
DownloadThreads int `default:"4" help:"Number of download threads."`
DryRun bool `help:"Calculate tiles to extract, but don't download them."`
Overfetch float32 `default:0.05 help:"What ratio of extra data to download to minimize # requests; 0.2 is 20%"`
Overfetch float32 `default:"0.05" help:"What ratio of extra data to download to minimize # requests; 0.2 is 20%"`
} `cmd:"" help:"Create an archive from a larger archive for a subset of zoom levels or geographic region."`

Verify struct {
Expand All @@ -66,8 +66,8 @@ var cli struct {

Makesync struct {
Input string `arg:"" type:"existingfile"`
BlockSizeKb int `default:1000 help:"The approximate block size, in kilobytes. 0 means 1 tile = 1 block."`
HashFunction string `default:fnv1a help:"The hash function."`
BlockSizeKb int `default:"1000" help:"The approximate block size, in kilobytes. 0 means 1 tile = 1 block."`
HashFunction string `default:"fnv1a" help:"The hash function."`
Checksum string `help:"Store a checksum in the syncfile."`
} `cmd:"" hidden:""`

Expand All @@ -79,9 +79,9 @@ var cli struct {
Serve struct {
Path string `arg:"" help:"Local path or bucket prefix"`
Interface string `default:"0.0.0.0"`
Port int `default:8080`
Port int `default:"8080"`
Cors string `help:"Value of HTTP CORS header."`
CacheSize int `default:64 help:"Size of cache in Megabytes."`
CacheSize int `default:"64" help:"Size of cache in Megabytes."`
Bucket string `help:"Remote bucket"`
PublicURL string `help:"Public base URL of tile endpoint for TileJSON e.g. https://example.com/tiles/"`
} `cmd:"" help:"Run an HTTP proxy server for Z/X/Y tiles."`
Expand All @@ -90,15 +90,15 @@ var cli struct {
OldFile string `type:"existingfile" help:"The old archive on disk. Providing this will check the new archive for a .sync file"`
NewFile string `arg:"The remote file."`
Bucket string `required:"" help:"Bucket of file to download."`
DownloadThreads int `default:4 help:"Number of download threads."`
DownloadThreads int `default:"4" help:"Number of download threads."`
DryRun bool `help:"Calculate new parts to download, but don't download them."`
Overfetch float32 `default:0.05 help:"What ratio of extra data to download to minimize # requests; 0.2 is 20%"`
Overfetch float32 `default:"0.05" help:"What ratio of extra data to download to minimize # requests; 0.2 is 20%"`
} `cmd:"" help:"Upload a local archive to remote storage."`

Upload struct {
Input string `arg:"" type:"existingfile"`
Key string `arg:""`
MaxConcurrency int `default:2 help:"# of upload threads"`
MaxConcurrency int `default:"2" help:"# of upload threads"`
Bucket string `required:"" help:"Bucket to upload to."`
} `cmd:"" help:"Upload a local archive to remote storage."`

Expand Down
2 changes: 0 additions & 2 deletions pmtiles/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,6 @@ func Extract(_ *log.Logger, bucketURL string, key string, minzoom int8, maxzoom
return err
}
}

return nil
})
}

Expand Down

0 comments on commit 702020a

Please sign in to comment.