Imports split into three groups: standard library, third-party, then this project's own packages

gci is configured with the sections standard, default and localmodule, and
goimports with the module path as its local prefix, so both formatters
agree.
This commit is contained in:
bwilliams committed 2026-10-14 17:40:06 +01:00
1 parent c9f42b62ad
commit e19c8c2b69
35 files changed
+85 -39

No files matched your search

+12
View File
@@ -51,6 +51,18 @@
"golines" "golines"
], ],
"settings": { "settings": {
"gci": {
"sections": [
"standard",
"default",
"localmodule"
]
},
"goimports": {
"local-prefixes": [
"git.avsdev.uk/Go/job-search"
]
},
"golines": { "golines": {
"max-len": 100, "max-len": 100,
"tab-len": 2 "tab-len": 2
+2 -1
View File
@@ -23,13 +23,14 @@ import (
"os" "os"
"strings" "strings"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli" "git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/cli/config" "git.avsdev.uk/Go/job-search/internal/cli/config"
"git.avsdev.uk/Go/job-search/internal/cli/fetch" "git.avsdev.uk/Go/job-search/internal/cli/fetch"
"git.avsdev.uk/Go/job-search/internal/cli/migrate" "git.avsdev.uk/Go/job-search/internal/cli/migrate"
"git.avsdev.uk/Go/job-search/internal/cli/version" "git.avsdev.uk/Go/job-search/internal/cli/version"
"git.avsdev.uk/Go/job-search/internal/cli/wsserve" "git.avsdev.uk/Go/job-search/internal/cli/wsserve"
"github.com/spf13/cobra"
) )
// newRootCmd builds the command tree. It returns a fresh tree on each call so // newRootCmd builds the command tree. It returns a fresh tree on each call so
+2 -1
View File
@@ -32,9 +32,10 @@ import (
"time" "time"
_ "time/tzdata" _ "time/tzdata"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/logging" "git.avsdev.uk/Go/job-search/internal/logging"
mock "git.avsdev.uk/Go/job-search/internal/mock/findatender" mock "git.avsdev.uk/Go/job-search/internal/mock/findatender"
"github.com/spf13/cobra"
) )
// options holds the values of every command-line flag. // options holds the values of every command-line flag.
+2 -1
View File
@@ -7,9 +7,10 @@ import (
"strings" "strings"
"testing" "testing"
"git.avsdev.uk/Go/job-search/internal/logging"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
"git.avsdev.uk/Go/job-search/internal/logging"
) )
// The commands themselves are tested through the real command tree in // The commands themselves are tested through the real command tree in
+3 -2
View File
@@ -14,10 +14,11 @@ import (
"strings" "strings"
"testing" "testing"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/logging"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/logging"
) )
// Setup changes into a new temporary directory holding an empty .env and, // Setup changes into a new temporary directory holding an empty .env and,
+2 -1
View File
@@ -3,8 +3,9 @@ package config
import ( import (
"log/slog" "log/slog"
"git.avsdev.uk/Go/job-search/internal/cli"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli"
) )
// NewCommand returns the "config" command, which shows and edits the configuration. // NewCommand returns the "config" command, which shows and edits the configuration.
+3 -2
View File
@@ -4,10 +4,11 @@ import (
"strings" "strings"
"testing" "testing"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/cli/cmdtest"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"go.yaml.in/yaml/v3" "go.yaml.in/yaml/v3"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/cli/cmdtest"
) )
// These tests run the config commands as a user would, through a root // These tests run the config commands as a user would, through a root
+2 -1
View File
@@ -4,8 +4,9 @@ import (
"fmt" "fmt"
"log/slog" "log/slog"
"git.avsdev.uk/Go/job-search/internal/cli"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli"
) )
func commandGet(opts *cli.Options) *cobra.Command { func commandGet(opts *cli.Options) *cobra.Command {
+2 -1
View File
@@ -7,9 +7,10 @@ import (
"os" "os"
"strings" "strings"
"git.avsdev.uk/Go/job-search/internal/config"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
"git.avsdev.uk/Go/job-search/internal/config"
) )
func commandInit() *cobra.Command { func commandInit() *cobra.Command {
+3 -2
View File
@@ -5,10 +5,11 @@ import (
"fmt" "fmt"
"log/slog" "log/slog"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/config"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/config"
) )
func commandSet(opts *cli.Options) *cobra.Command { func commandSet(opts *cli.Options) *cobra.Command {
+2 -1
View File
@@ -4,8 +4,9 @@ import (
"fmt" "fmt"
"log/slog" "log/slog"
"git.avsdev.uk/Go/job-search/internal/cli"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli"
) )
func commandShow(opts *cli.Options) *cobra.Command { func commandShow(opts *cli.Options) *cobra.Command {
+2 -1
View File
@@ -3,8 +3,9 @@ package fetch
import ( import (
"log/slog" "log/slog"
"git.avsdev.uk/Go/job-search/internal/cli"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli"
) )
// NewCommand returns the "fetch" command, which fetches opportunities once or as a service. // NewCommand returns the "fetch" command, which fetches opportunities once or as a service.
+2 -1
View File
@@ -7,10 +7,11 @@ import (
"slices" "slices"
"time" "time"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli" "git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/findatender" "git.avsdev.uk/Go/job-search/internal/findatender"
"git.avsdev.uk/Go/job-search/internal/types" "git.avsdev.uk/Go/job-search/internal/types"
"github.com/spf13/cobra"
) )
// Release tags for each stage of a procedure, from the OCDS releaseTag // Release tags for each stage of a procedure, from the OCDS releaseTag
+2 -1
View File
@@ -9,9 +9,10 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli" "git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/fetcher" "git.avsdev.uk/Go/job-search/internal/fetcher"
"github.com/spf13/cobra"
) )
func commandService(opts *cli.Options) *cobra.Command { func commandService(opts *cli.Options) *cobra.Command {
+2 -1
View File
@@ -5,9 +5,10 @@ import (
"os" "os"
"testing" "testing"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli" "git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/cli/cmdtest" "git.avsdev.uk/Go/job-search/internal/cli/cmdtest"
"github.com/spf13/cobra"
) )
// The shared flags (--config, --debug and --quiet), run through a root // The shared flags (--config, --debug and --quiet), run through a root
+2 -1
View File
@@ -3,8 +3,9 @@ package cli
import ( import (
"log/slog" "log/slog"
"git.avsdev.uk/Go/job-search/internal/logging"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/logging"
) )
// SetupInitialLogging starts logging to the terminal, at the level set by // SetupInitialLogging starts logging to the terminal, at the level set by
+3 -2
View File
@@ -10,10 +10,11 @@ import (
"path/filepath" "path/filepath"
"time" "time"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/store"
"github.com/pressly/goose/v3" "github.com/pressly/goose/v3"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/store"
) )
// openMigrator loads the configuration and returns a migrator over the // openMigrator loads the configuration and returns a migrator over the
+2 -1
View File
@@ -5,9 +5,10 @@ import (
"fmt" "fmt"
"log/slog" "log/slog"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli" "git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/store" "git.avsdev.uk/Go/job-search/internal/store"
"github.com/spf13/cobra"
) )
func commandDown(opts *cli.Options) *cobra.Command { func commandDown(opts *cli.Options) *cobra.Command {
+2 -1
View File
@@ -9,8 +9,9 @@ package migrate
import ( import (
"log/slog" "log/slog"
"git.avsdev.uk/Go/job-search/internal/cli"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli"
) )
// NewCommand returns the "migrate" command, which migrates the database schema (see // NewCommand returns the "migrate" command, which migrates the database schema (see
+2 -1
View File
@@ -5,10 +5,11 @@ import (
"path/filepath" "path/filepath"
"testing" "testing"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli" "git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/cli/cmdtest" "git.avsdev.uk/Go/job-search/internal/cli/cmdtest"
"git.avsdev.uk/Go/job-search/internal/store" "git.avsdev.uk/Go/job-search/internal/store"
"github.com/spf13/cobra"
) )
// Run with: go test -tags sqlite_fts5 ./... // Run with: go test -tags sqlite_fts5 ./...
+3 -2
View File
@@ -8,10 +8,11 @@ import (
"path/filepath" "path/filepath"
"text/tabwriter" "text/tabwriter"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/store"
"github.com/pressly/goose/v3" "github.com/pressly/goose/v3"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/store"
) )
// printStatus lists every migration as applied (with when) or pending, // printStatus lists every migration as applied (with when) or pending,
+2 -1
View File
@@ -4,9 +4,10 @@ import (
"fmt" "fmt"
"log/slog" "log/slog"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli" "git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/store" "git.avsdev.uk/Go/job-search/internal/store"
"github.com/spf13/cobra"
) )
// runStepUp applies steps pending migrations (0 means all), printing each one // runStepUp applies steps pending migrations (0 means all), printing each one
+2 -1
View File
@@ -4,9 +4,10 @@ import (
"fmt" "fmt"
"log/slog" "log/slog"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/config" "git.avsdev.uk/Go/job-search/internal/config"
"git.avsdev.uk/Go/job-search/internal/logging" "git.avsdev.uk/Go/job-search/internal/logging"
"github.com/spf13/cobra"
) )
// Options holds the flags shared by every command. Bind registers them on the // Options holds the flags shared by every command. Bind registers them on the
+2 -1
View File
@@ -4,8 +4,9 @@ import (
"fmt" "fmt"
"log/slog" "log/slog"
"git.avsdev.uk/Go/job-search/internal/version"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/version"
) )
// NewCommand returns the "version" command. // NewCommand returns the "version" command.
+2 -1
View File
@@ -10,10 +10,11 @@ import (
"strings" "strings"
"syscall" "syscall"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli" "git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/websocket" "git.avsdev.uk/Go/job-search/internal/websocket"
"git.avsdev.uk/Go/job-search/internal/websocket/tcpserver" "git.avsdev.uk/Go/job-search/internal/websocket/tcpserver"
"github.com/spf13/cobra"
) )
func NewCommand(opts *cli.Options) *cobra.Command { func NewCommand(opts *cli.Options) *cobra.Command {
+2 -1
View File
@@ -13,9 +13,10 @@ import (
"strings" "strings"
"time" "time"
resty "resty.dev/v3"
"git.avsdev.uk/Go/job-search/internal/findatender/ocds" "git.avsdev.uk/Go/job-search/internal/findatender/ocds"
"git.avsdev.uk/Go/job-search/internal/logging" "git.avsdev.uk/Go/job-search/internal/logging"
resty "resty.dev/v3"
) )
// Errors returned when fetching from the API. // Errors returned when fetching from the API.
+2 -1
View File
@@ -15,9 +15,10 @@ import (
"testing" "testing"
"time" "time"
resty "resty.dev/v3"
"git.avsdev.uk/Go/job-search/internal/config" "git.avsdev.uk/Go/job-search/internal/config"
"git.avsdev.uk/Go/job-search/internal/findatender/ocds" "git.avsdev.uk/Go/job-search/internal/findatender/ocds"
resty "resty.dev/v3"
) )
func testConfig(level string) *config.JobSearchConfig { func testConfig(level string) *config.JobSearchConfig {
+2 -1
View File
@@ -5,9 +5,10 @@ import (
"log/slog" "log/slog"
"time" "time"
resty "resty.dev/v3"
"git.avsdev.uk/Go/job-search/internal/config" "git.avsdev.uk/Go/job-search/internal/config"
"git.avsdev.uk/Go/job-search/internal/types" "git.avsdev.uk/Go/job-search/internal/types"
resty "resty.dev/v3"
) )
// FindATender is a client for the Find a Tender OCDS API (or the mock // FindATender is a client for the Find a Tender OCDS API (or the mock
+2 -1
View File
@@ -8,8 +8,9 @@ import (
"strings" "strings"
"testing" "testing"
"git.avsdev.uk/Go/job-search/internal/store"
"github.com/pressly/goose/v3" "github.com/pressly/goose/v3"
"git.avsdev.uk/Go/job-search/internal/store"
) )
// Run with: go test -tags sqlite_fts5 ./... // Run with: go test -tags sqlite_fts5 ./...
+2 -1
View File
@@ -12,9 +12,10 @@ import (
"time" "time"
"unicode" "unicode"
"git.avsdev.uk/Go/job-search/internal/types"
"github.com/jmoiron/sqlx" "github.com/jmoiron/sqlx"
"github.com/mattn/go-sqlite3" "github.com/mattn/go-sqlite3"
"git.avsdev.uk/Go/job-search/internal/types"
) )
// ErrNotFound is returned when a requested opportunity does not exist. // ErrNotFound is returned when a requested opportunity does not exist.
+2 -1
View File
@@ -12,8 +12,9 @@ import (
"testing" "testing"
"time" "time"
"git.avsdev.uk/Go/job-search/internal/config"
ws "github.com/coder/websocket" ws "github.com/coder/websocket"
"git.avsdev.uk/Go/job-search/internal/config"
) )
// fakeConn is a msgConn that records how it was closed. Read blocks until its // fakeConn is a msgConn that records how it was closed. Read blocks until its
+2 -1
View File
@@ -4,8 +4,9 @@ import (
"context" "context"
"net/http" "net/http"
"git.avsdev.uk/Go/job-search/internal/middleware"
ws "github.com/coder/websocket" ws "github.com/coder/websocket"
"git.avsdev.uk/Go/job-search/internal/middleware"
) )
// ServeHTTP upgrades an http connection and runs the client until it closes. // ServeHTTP upgrades an http connection and runs the client until it closes.
+2 -1
View File
@@ -8,9 +8,10 @@ import (
"testing" "testing"
"time" "time"
"git.avsdev.uk/Go/job-search/internal/config"
ws "github.com/coder/websocket" ws "github.com/coder/websocket"
"github.com/coder/websocket/wsjson" "github.com/coder/websocket/wsjson"
"git.avsdev.uk/Go/job-search/internal/config"
) )
// wsHub serves h's WebSocket clients on a test HTTP server and returns its // wsHub serves h's WebSocket clients on a test HTTP server and returns its
+2 -1
View File
@@ -6,8 +6,9 @@ import (
"log/slog" "log/slog"
"sync" "sync"
"git.avsdev.uk/Go/job-search/internal/config"
ws "github.com/coder/websocket" ws "github.com/coder/websocket"
"git.avsdev.uk/Go/job-search/internal/config"
) )
// Hub tracks connected clients, WebSocket (ServeHTTP) and plain TCP // Hub tracks connected clients, WebSocket (ServeHTTP) and plain TCP
+2 -1
View File
@@ -13,8 +13,9 @@ import (
"testing" "testing"
"time" "time"
"git.avsdev.uk/Go/job-search/internal/config"
ws "github.com/coder/websocket" ws "github.com/coder/websocket"
"git.avsdev.uk/Go/job-search/internal/config"
) )
var discardLog = slog.New(slog.NewTextHandler(io.Discard, nil)) var discardLog = slog.New(slog.NewTextHandler(io.Discard, nil))