diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a62bb01..a81c216 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,7 +82,19 @@ jobs: - uses: actions/setup-go@v5 with: - go-version: "1.23" + # gofmt is a standalone binary and does not follow the toolchain + # switch that go.mod's `go 1.25.0` triggers for go commands, so this + # job pins the version the module requires. + go-version: "1.25" + + - name: Format check + run: | + unformatted=$(gofmt -l .) + if [ -n "$unformatted" ]; then + echo "gofmt -w . is needed for:" + echo "$unformatted" + exit 1 + fi - name: Vet run: go vet ./... diff --git a/internal/cli/download_cmd.go b/internal/cli/download_cmd.go index 3617607..1ec4516 100644 --- a/internal/cli/download_cmd.go +++ b/internal/cli/download_cmd.go @@ -14,14 +14,14 @@ import ( func newDownloadCmd() *cobra.Command { var ( - fromFile string - urlsFile string - singleURL string - outputDir string - parallel int + fromFile string + urlsFile string + singleURL string + outputDir string + parallel int maxSamples int - dryRun bool - force bool + dryRun bool + force bool ) cmd := &cobra.Command{ diff --git a/internal/cli/query_cmd.go b/internal/cli/query_cmd.go index c16b099..120b371 100644 --- a/internal/cli/query_cmd.go +++ b/internal/cli/query_cmd.go @@ -14,8 +14,8 @@ import ( cols "github.com/allthebacteria/atb-cli/internal/columns" idx "github.com/allthebacteria/atb-cli/internal/index" - pq "github.com/allthebacteria/atb-cli/internal/parquet" "github.com/allthebacteria/atb-cli/internal/output" + pq "github.com/allthebacteria/atb-cli/internal/parquet" "github.com/allthebacteria/atb-cli/internal/query" "github.com/allthebacteria/atb-cli/internal/suggest" ) diff --git a/internal/index/query.go b/internal/index/query.go index 4ac8259..5535cb8 100644 --- a/internal/index/query.go +++ b/internal/index/query.go @@ -72,40 +72,40 @@ type QueryParams struct { // userColToSQL maps user-facing column names to SQLite column names. var userColToSQL = map[string]string{ - "sample_accession": "sample_accession", - "run_accession": "run_accession", - "assembly_accession": "assembly_accession", - "sylph_species": "sylph_species", - "hq_filter": "hq_filter", - "asm_fasta_on_osf": "asm_fasta_on_osf", - "dataset": "dataset", - "scientific_name": "scientific_name", - "aws_url": "aws_url", - "osf_tarball_url": "osf_tarball_url", - "total_length": "total_length", - "number": "num_contigs", - "N50": "n50", - "N90": "n90", + "sample_accession": "sample_accession", + "run_accession": "run_accession", + "assembly_accession": "assembly_accession", + "sylph_species": "sylph_species", + "hq_filter": "hq_filter", + "asm_fasta_on_osf": "asm_fasta_on_osf", + "dataset": "dataset", + "scientific_name": "scientific_name", + "aws_url": "aws_url", + "osf_tarball_url": "osf_tarball_url", + "total_length": "total_length", + "number": "num_contigs", + "N50": "n50", + "N90": "n90", "Completeness_General": "completeness", - "Contamination": "contamination", - "Genome_Size": "genome_size", - "GC_Content": "gc_content", - "mlst_scheme": "mlst_scheme", - "mlst_st": "mlst_st", - "mlst_status": "mlst_status", - "mlst_score": "mlst_score", - "mlst_alleles": "mlst_alleles", + "Contamination": "contamination", + "Genome_Size": "genome_size", + "GC_Content": "gc_content", + "mlst_scheme": "mlst_scheme", + "mlst_st": "mlst_st", + "mlst_status": "mlst_status", + "mlst_score": "mlst_score", + "mlst_alleles": "mlst_alleles", } // sqlToUserCol is the reverse mapping, used when building result maps. var sqlToUserCol = map[string]string{ - "num_contigs": "number", - "n50": "N50", - "n90": "N90", - "completeness": "Completeness_General", + "num_contigs": "number", + "n50": "N50", + "n90": "N90", + "completeness": "Completeness_General", "contamination": "Contamination", - "genome_size": "Genome_Size", - "gc_content": "GC_Content", + "genome_size": "Genome_Size", + "gc_content": "GC_Content", } // allSQLCols is the full list of columns in SELECT order. diff --git a/internal/query/executor_test.go b/internal/query/executor_test.go index 703e699..821be2a 100644 --- a/internal/query/executor_test.go +++ b/internal/query/executor_test.go @@ -294,10 +294,10 @@ func TestParseCollectionDate(t *testing.T) { return t } cases := []struct { - in string - wantOK bool - wantStart time.Time - wantEnd time.Time + in string + wantOK bool + wantStart time.Time + wantEnd time.Time }{ {"2020-05-15", true, d("2020-05-15"), d("2020-05-15")}, {"2020-05", true, d("2020-05-01"), d("2020-05-31")}, diff --git a/internal/selfupdate/selfupdate.go b/internal/selfupdate/selfupdate.go index c63d066..20d9236 100644 --- a/internal/selfupdate/selfupdate.go +++ b/internal/selfupdate/selfupdate.go @@ -14,9 +14,9 @@ import ( ) const ( - repo = "allthebacteria/atb-cli" - checkInterval = 24 * time.Hour - stateFileName = "update-state.json" + repo = "allthebacteria/atb-cli" + checkInterval = 24 * time.Hour + stateFileName = "update-state.json" ) type Release struct {