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"
],
"settings": {
"gci": {
"sections": [
"standard",
"default",
"localmodule"
]
},
"goimports": {
"local-prefixes": [
"git.avsdev.uk/Go/job-search"
]
},
"golines": {
"max-len": 100,
"tab-len": 2
+2 -1
View File
@@ -23,13 +23,14 @@ import (
"os"
"strings"
"github.com/spf13/cobra"
"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/fetch"
"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/wsserve"
"github.com/spf13/cobra"
)
// 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/tzdata"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/logging"
mock "git.avsdev.uk/Go/job-search/internal/mock/findatender"
"github.com/spf13/cobra"
)
// options holds the values of every command-line flag.
+2 -1
View File
@@ -7,9 +7,10 @@ import (
"strings"
"testing"
"git.avsdev.uk/Go/job-search/internal/logging"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"git.avsdev.uk/Go/job-search/internal/logging"
)
// The commands themselves are tested through the real command tree in
+3 -2
View File
@@ -14,10 +14,11 @@ import (
"strings"
"testing"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/logging"
"github.com/spf13/cobra"
"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,
+2 -1
View File
@@ -3,8 +3,9 @@ package config
import (
"log/slog"
"git.avsdev.uk/Go/job-search/internal/cli"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli"
)
// NewCommand returns the "config" command, which shows and edits the configuration.
+3 -2
View File
@@ -4,10 +4,11 @@ import (
"strings"
"testing"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/cli/cmdtest"
"github.com/spf13/cobra"
"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
+2 -1
View File
@@ -4,8 +4,9 @@ import (
"fmt"
"log/slog"
"git.avsdev.uk/Go/job-search/internal/cli"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli"
)
func commandGet(opts *cli.Options) *cobra.Command {
+2 -1
View File
@@ -7,9 +7,10 @@ import (
"os"
"strings"
"git.avsdev.uk/Go/job-search/internal/config"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"git.avsdev.uk/Go/job-search/internal/config"
)
func commandInit() *cobra.Command {
+3 -2
View File
@@ -5,10 +5,11 @@ import (
"fmt"
"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/viper"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/config"
)
func commandSet(opts *cli.Options) *cobra.Command {
+2 -1
View File
@@ -4,8 +4,9 @@ import (
"fmt"
"log/slog"
"git.avsdev.uk/Go/job-search/internal/cli"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli"
)
func commandShow(opts *cli.Options) *cobra.Command {
+2 -1
View File
@@ -3,8 +3,9 @@ package fetch
import (
"log/slog"
"git.avsdev.uk/Go/job-search/internal/cli"
"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.
+2 -1
View File
@@ -7,10 +7,11 @@ import (
"slices"
"time"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/findatender"
"git.avsdev.uk/Go/job-search/internal/types"
"github.com/spf13/cobra"
)
// Release tags for each stage of a procedure, from the OCDS releaseTag
+2 -1
View File
@@ -9,9 +9,10 @@ import (
"syscall"
"time"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/fetcher"
"github.com/spf13/cobra"
)
func commandService(opts *cli.Options) *cobra.Command {
+2 -1
View File
@@ -5,9 +5,10 @@ import (
"os"
"testing"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/cli/cmdtest"
"github.com/spf13/cobra"
)
// The shared flags (--config, --debug and --quiet), run through a root
+2 -1
View File
@@ -3,8 +3,9 @@ package cli
import (
"log/slog"
"git.avsdev.uk/Go/job-search/internal/logging"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/logging"
)
// SetupInitialLogging starts logging to the terminal, at the level set by
+3 -2
View File
@@ -10,10 +10,11 @@ import (
"path/filepath"
"time"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/store"
"github.com/pressly/goose/v3"
"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
+2 -1
View File
@@ -5,9 +5,10 @@ import (
"fmt"
"log/slog"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/store"
"github.com/spf13/cobra"
)
func commandDown(opts *cli.Options) *cobra.Command {
+2 -1
View File
@@ -9,8 +9,9 @@ package migrate
import (
"log/slog"
"git.avsdev.uk/Go/job-search/internal/cli"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli"
)
// NewCommand returns the "migrate" command, which migrates the database schema (see
+2 -1
View File
@@ -5,10 +5,11 @@ import (
"path/filepath"
"testing"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/cli/cmdtest"
"git.avsdev.uk/Go/job-search/internal/store"
"github.com/spf13/cobra"
)
// Run with: go test -tags sqlite_fts5 ./...
+3 -2
View File
@@ -8,10 +8,11 @@ import (
"path/filepath"
"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/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,
+2 -1
View File
@@ -4,9 +4,10 @@ import (
"fmt"
"log/slog"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/store"
"github.com/spf13/cobra"
)
// runStepUp applies steps pending migrations (0 means all), printing each one
+2 -1
View File
@@ -4,9 +4,10 @@ import (
"fmt"
"log/slog"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/config"
"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
+2 -1
View File
@@ -4,8 +4,9 @@ import (
"fmt"
"log/slog"
"git.avsdev.uk/Go/job-search/internal/version"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/version"
)
// NewCommand returns the "version" command.
+2 -1
View File
@@ -10,10 +10,11 @@ import (
"strings"
"syscall"
"github.com/spf13/cobra"
"git.avsdev.uk/Go/job-search/internal/cli"
"git.avsdev.uk/Go/job-search/internal/websocket"
"git.avsdev.uk/Go/job-search/internal/websocket/tcpserver"
"github.com/spf13/cobra"
)
func NewCommand(opts *cli.Options) *cobra.Command {
+2 -1
View File
@@ -13,9 +13,10 @@ import (
"strings"
"time"
resty "resty.dev/v3"
"git.avsdev.uk/Go/job-search/internal/findatender/ocds"
"git.avsdev.uk/Go/job-search/internal/logging"
resty "resty.dev/v3"
)
// Errors returned when fetching from the API.
+2 -1
View File
@@ -15,9 +15,10 @@ import (
"testing"
"time"
resty "resty.dev/v3"
"git.avsdev.uk/Go/job-search/internal/config"
"git.avsdev.uk/Go/job-search/internal/findatender/ocds"
resty "resty.dev/v3"
)
func testConfig(level string) *config.JobSearchConfig {
+2 -1
View File
@@ -5,9 +5,10 @@ import (
"log/slog"
"time"
resty "resty.dev/v3"
"git.avsdev.uk/Go/job-search/internal/config"
"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
+2 -1
View File
@@ -8,8 +8,9 @@ import (
"strings"
"testing"
"git.avsdev.uk/Go/job-search/internal/store"
"github.com/pressly/goose/v3"
"git.avsdev.uk/Go/job-search/internal/store"
)
// Run with: go test -tags sqlite_fts5 ./...
+2 -1
View File
@@ -12,9 +12,10 @@ import (
"time"
"unicode"
"git.avsdev.uk/Go/job-search/internal/types"
"github.com/jmoiron/sqlx"
"github.com/mattn/go-sqlite3"
"git.avsdev.uk/Go/job-search/internal/types"
)
// ErrNotFound is returned when a requested opportunity does not exist.
+2 -1
View File
@@ -12,8 +12,9 @@ import (
"testing"
"time"
"git.avsdev.uk/Go/job-search/internal/config"
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
+2 -1
View File
@@ -4,8 +4,9 @@ import (
"context"
"net/http"
"git.avsdev.uk/Go/job-search/internal/middleware"
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.
+2 -1
View File
@@ -8,9 +8,10 @@ import (
"testing"
"time"
"git.avsdev.uk/Go/job-search/internal/config"
ws "github.com/coder/websocket"
"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
+2 -1
View File
@@ -6,8 +6,9 @@ import (
"log/slog"
"sync"
"git.avsdev.uk/Go/job-search/internal/config"
ws "github.com/coder/websocket"
"git.avsdev.uk/Go/job-search/internal/config"
)
// Hub tracks connected clients, WebSocket (ServeHTTP) and plain TCP
+2 -1
View File
@@ -13,8 +13,9 @@ import (
"testing"
"time"
"git.avsdev.uk/Go/job-search/internal/config"
ws "github.com/coder/websocket"
"git.avsdev.uk/Go/job-search/internal/config"
)
var discardLog = slog.New(slog.NewTextHandler(io.Discard, nil))