Naming, layout and comments: descriptive full-word names, one item per line in wrapped calls and literals, and doc comments on exported names
Short and single-letter names in application code become full words (tests keep theirs). Wrapped calls, signatures and composite literals put one item per line, and one-line function bodies are expanded. Exported names and groups of constants get doc comments, and comments refer to the renamed identifiers.
This commit is contained in:
1 parent
043e307663
commit
465358609a
78 files changed
+2374
-1402
No files matched your search
@@ -15,9 +15,12 @@ import (
|
||||
// runFTSMock polls the mock Find a Tender server every configured interval
|
||||
// until ctx is cancelled.
|
||||
func runFTSMock(
|
||||
ctx context.Context, logger *slog.Logger, conf *config.JobSearchConfig, since time.Time,
|
||||
ctx context.Context,
|
||||
logger *slog.Logger,
|
||||
conf *config.JobSearchConfig,
|
||||
since time.Time,
|
||||
) error {
|
||||
w := util.Worker{
|
||||
worker := util.Worker{
|
||||
Logger: logger,
|
||||
Name: "FTSMock",
|
||||
Interval: conf.Sources.FTSMock.Interval,
|
||||
@@ -25,19 +28,26 @@ func runFTSMock(
|
||||
return fetchFTSMock(ctx, logger, conf, since)
|
||||
},
|
||||
}
|
||||
return w.Run(ctx, since)
|
||||
return worker.Run(ctx, since)
|
||||
}
|
||||
|
||||
// fetchFTSMock fetches everything updated since since from the mock Find a
|
||||
// Tender server. Finding nothing returns ErrNoNewReleases, so the worker still
|
||||
// moves its checkpoint on.
|
||||
func fetchFTSMock(
|
||||
ctx context.Context, logger *slog.Logger, conf *config.JobSearchConfig, since time.Time,
|
||||
ctx context.Context,
|
||||
logger *slog.Logger,
|
||||
conf *config.JobSearchConfig,
|
||||
since time.Time,
|
||||
) error {
|
||||
opportunities, err := util.AwaitTask(ctx, func() ([]*types.Opportunity, error) {
|
||||
ft := findatender.New(conf, conf.Sources.FTSMock.APIRoot, findatender.WithLogger(logger))
|
||||
defer ft.Shutdown()
|
||||
return ft.With(ctx).FetchAll(since, true)
|
||||
findATender := findatender.New(
|
||||
conf,
|
||||
conf.Sources.FTSMock.APIRoot,
|
||||
findatender.WithLogger(logger),
|
||||
)
|
||||
defer findATender.Shutdown()
|
||||
return findATender.With(ctx).FetchAll(since, true)
|
||||
})
|
||||
if errors.Is(err, findatender.ErrNoReleases) {
|
||||
return ErrNoNewReleases
|
||||
|
||||
Reference in new issue
Block a user