Skip to content

Commit f3d1b86

Browse files
committed
chore: Fmt
1 parent 07873e2 commit f3d1b86

16 files changed

Lines changed: 160 additions & 80 deletions

File tree

example/calculator/cmd/server/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ func main() {
4646
}
4747

4848
a := app.NewApp(sha256.Sum256([]byte(hmacSecret)))
49-
s := datapagesgen.NewServer(a, msgBroker,
49+
s := datapagesgen.NewServer(
50+
a, msgBroker,
5051
datapagesgen.WithAssets(app.StaticFS),
5152
)
5253

example/calculator/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ func main() {
3131
// nor the NATS message broker, since it's a single-user system.
3232
a := app.NewApp([32]byte{})
3333
msgBroker := inmem.New(8)
34-
s := datapagesgen.NewServer(a, msgBroker,
34+
s := datapagesgen.NewServer(
35+
a, msgBroker,
3536
datapagesgen.WithAssets(app.StaticFS),
3637
)
3738

example/classifieds/cmd/server/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ func initMetrics(m *app.Metrics, opts *[]datapagesgen.ServerOption) {
182182
}
183183

184184
addr := net.JoinHostPort(host, port)
185-
*opts = append(*opts,
185+
*opts = append(
186+
*opts,
186187
datapagesgen.WithPrometheus(datapagesgen.PrometheusConfig{
187188
Host: addr,
188189
Collectors: []prometheus.Collector{

generator/write_app_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,8 @@ func TestWritePageGETStreamHandler(t *testing.T) {
999999
Route: "/dashboard/",
10001000
EventHandlers: []*model.EventHandler{
10011001
testEventHandler(
1002-
"MessagingSent", "EventMessagingSent", withEHSession, withEHErr),
1002+
"MessagingSent", "EventMessagingSent", withEHSession, withEHErr,
1003+
),
10031004
testEventHandler("CalcUpdated", "EventCalcUpdated", withEHErr),
10041005
},
10051006
},

internal/cmd/cmd_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ func TestRun(t *testing.T) {
6060
} {
6161
t.Run(name, func(t *testing.T) {
6262
var stdout, stderr bytes.Buffer
63-
code := cmd.Run(context.Background(), tc.args,
63+
code := cmd.Run(
64+
context.Background(), tc.args,
6465
nil, &stdout, &stderr,
6566
"0.0.0", "xxxxxxx", "2026-2-23",
6667
)

internal/cmd/config/config.go

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -185,31 +185,43 @@ func (r *WatcherRequires) UnmarshalText(text []byte) error {
185185
// Sentinel errors for assets validation.
186186
var (
187187
ErrAssetsDirRequired = errors.New(
188-
"assets.dir is required when embedded asset serving is enabled")
188+
"assets.dir is required when embedded asset serving is enabled",
189+
)
189190
ErrAssetsURLPrefixRequired = errors.New(
190-
"assets.url-prefix is required when embedded asset serving is enabled")
191+
"assets.url-prefix is required when embedded asset serving is enabled",
192+
)
191193
ErrAssetsURLPrefixNoLeadingSlash = errors.New(
192-
"assets.url-prefix must start with '/'")
194+
"assets.url-prefix must start with '/'",
195+
)
193196
ErrAssetsURLPrefixNoTrailingSlash = errors.New(
194-
"assets.url-prefix must end with '/'")
197+
"assets.url-prefix must end with '/'",
198+
)
195199
ErrAssetsURLPrefixDoubleSlash = errors.New(
196-
"assets.url-prefix must not contain double slashes")
200+
"assets.url-prefix must not contain double slashes",
201+
)
197202
ErrAssetsURLPrefixQueryString = errors.New(
198-
"assets.url-prefix must not contain a query string")
203+
"assets.url-prefix must not contain a query string",
204+
)
199205
ErrAssetsURLPrefixFragment = errors.New(
200-
"assets.url-prefix must not contain a fragment")
206+
"assets.url-prefix must not contain a fragment",
207+
)
201208
ErrAssetsURLPrefixDotSegment = errors.New(
202-
"assets.url-prefix must not contain dot segments")
209+
"assets.url-prefix must not contain dot segments",
210+
)
203211
ErrAssetsURLPrefixBackslash = errors.New(
204-
"assets.url-prefix must not contain backslashes")
212+
"assets.url-prefix must not contain backslashes",
213+
)
205214
ErrAssetsURLPrefixEncodedTraversal = errors.New(
206215
"assets.url-prefix must not contain percent-encoded dots, " +
207-
"slashes, or backslashes")
216+
"slashes, or backslashes",
217+
)
208218
ErrAssetsURLPrefixRoot = errors.New(
209-
"assets.url-prefix must not be \"/\"; it would conflict with page routes")
219+
"assets.url-prefix must not be \"/\"; it would conflict with page routes",
220+
)
210221
ErrAssetsURLPrefixInvalidChar = errors.New(
211222
"assets.url-prefix contains invalid characters; " +
212-
"use only ASCII letters, digits, hyphens, underscores, and slashes")
223+
"use only ASCII letters, digits, hyphens, underscores, and slashes",
224+
)
213225
)
214226

215227
// ValidateAssetsURLPrefix checks that s is a valid URL path prefix for embedded files.

internal/cmd/gen.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ func parseApp(appDir string, stderr io.Writer) (*model.App, error) {
147147
if i > 0 {
148148
_, _ = fmt.Fprintln(stderr)
149149
}
150-
_, _ = fmt.Fprintf(stderr, "%s %s\n",
150+
_, _ = fmt.Fprintf(
151+
stderr, "%s %s\n",
151152
loc.Sprintf("at %s:%d:%d:", pos.Filename, pos.Line, pos.Column),
152153
msg.Sprint(innerErr.Error()),
153154
)

internal/cmd/update_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ func TestStartUpdateCheck(t *testing.T) {
5959
TagName string `json:"tag_name"`
6060
HTMLURL string `json:"html_url"`
6161
}{TagName: tc.responseTag, HTMLURL: tc.responseHTMLURL})
62-
}))
62+
}),
63+
)
6364
t.Cleanup(srv.Close)
6465

6566
// Redirect all requests to the test server.
@@ -116,7 +117,8 @@ func TestPrintUpdateNotice(t *testing.T) {
116117

117118
var buf bytes.Buffer
118119
printUpdateNotice(&buf, "v1.2.3", "https://example.com/changelog")
119-
require.Equal(t,
120+
require.Equal(
121+
t,
120122
"update available: v1.2.3 — run: go install "+
121123
datapagesModulePath+
122124
"@latest\nchangelog: https://example.com/changelog\n",

internal/templatingbench/templating_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ var stdTmpl = template.Must(template.New("hello").Parse(
2222

2323
var (
2424
jetSet = jet.NewSet(jet.NewInMemLoader())
25-
jetTmpl, _ = jetSet.Parse("hello",
25+
jetTmpl, _ = jetSet.Parse(
26+
"hello",
2627
`<div><h1>Hello, {{name}}!</h1><p>Welcome to the benchmark.</p></div>`,
2728
)
2829
)

modules/sessmanager/inmem/sessmem_test.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ func TestCreateSession(t *testing.T) {
130130
require.NotEmpty(t, token)
131131

132132
sess, retTok, uid, ok, err := sm.ReadSessionFromCookie(
133-
&http.Cookie{Value: token})
133+
&http.Cookie{Value: token},
134+
)
134135
require.NoError(t, err)
135136
require.True(t, ok)
136137
require.Equal(t, token, retTok)
@@ -186,7 +187,8 @@ func TestCreateSessionTokenCollisionOverwrites(t *testing.T) {
186187

187188
// The second session overwrites the first.
188189
sess, retTok, uid, ok, err := sm.ReadSessionFromCookie(
189-
&http.Cookie{Value: tok1})
190+
&http.Cookie{Value: tok1},
191+
)
190192
require.NoError(t, err)
191193
require.True(t, ok)
192194
require.Equal(t, tok1, retTok)
@@ -229,7 +231,8 @@ func TestCloseSession(t *testing.T) {
229231
require.NoError(t, err)
230232

231233
_, _, _, ok, err := sm.ReadSessionFromCookie(
232-
&http.Cookie{Value: token})
234+
&http.Cookie{Value: token},
235+
)
233236
require.NoError(t, err)
234237
require.False(t, ok)
235238
})
@@ -708,7 +711,8 @@ func TestConcurrentCreateAndRead(t *testing.T) {
708711
go func(i int) {
709712
defer wg.Done()
710713
sess, _, _, ok, err := sm.ReadSessionFromCookie(
711-
&http.Cookie{Value: tokens[i]})
714+
&http.Cookie{Value: tokens[i]},
715+
)
712716
readErrs[i] = err
713717
readOK[i] = ok
714718
readSess[i] = sess
@@ -753,7 +757,8 @@ func TestConcurrentCreateAndClose(t *testing.T) {
753757

754758
for _, tok := range tokens {
755759
_, _, _, ok, err := sm.ReadSessionFromCookie(
756-
&http.Cookie{Value: tok})
760+
&http.Cookie{Value: tok},
761+
)
757762
require.NoError(t, err)
758763
require.False(t, ok)
759764
}
@@ -848,7 +853,8 @@ func TestConcurrentReadDuringClose(t *testing.T) {
848853
go func() {
849854
defer wg.Done()
850855
readSess, _, _, readOK, readErr = sm.ReadSessionFromCookie(
851-
&http.Cookie{Value: token})
856+
&http.Cookie{Value: token},
857+
)
852858
}()
853859

854860
go func() {

0 commit comments

Comments
 (0)