From aa9028f200807db1781fa09b8a30c32b880345c2 Mon Sep 17 00:00:00 2001 From: Christopher Hunter Date: Tue, 22 Oct 2024 09:12:06 -0700 Subject: [PATCH] format --- internal/source/imports.go | 2 +- internal/source/reflect_test.go | 4 +--- internal/source/template_test.go | 5 +++-- name.go | 1 + routes.go | 3 ++- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/source/imports.go b/internal/source/imports.go index f7e2852..974a1a8 100644 --- a/internal/source/imports.go +++ b/internal/source/imports.go @@ -99,7 +99,7 @@ func (imports *Imports) AddNetHTTP() string { return imports.Add("", "net/h func (imports *Imports) AddHTMLTemplate() string { return imports.Add("", "html/template") } func (imports *Imports) AddContext() string { return imports.Add("", "context") } -func (imports *Imports) HTTPErrorCall(response ast.Expr, message ast.Expr, code int) *ast.CallExpr { +func (imports *Imports) HTTPErrorCall(response, message ast.Expr, code int) *ast.CallExpr { return imports.Call("", "net/http", "Error", []ast.Expr{ response, message, diff --git a/internal/source/reflect_test.go b/internal/source/reflect_test.go index f3e4d22..94e94c9 100644 --- a/internal/source/reflect_test.go +++ b/internal/source/reflect_test.go @@ -2,6 +2,4 @@ package source import "testing" -func TestParseStringWithType(t *testing.T) { - -} +func TestParseStringWithType(t *testing.T) {} diff --git a/internal/source/template_test.go b/internal/source/template_test.go index 163df1c..480dfbb 100644 --- a/internal/source/template_test.go +++ b/internal/source/template_test.go @@ -1,18 +1,19 @@ package source_test import ( - "github.com/stretchr/testify/assert" "go/ast" "go/parser" "go/token" - "golang.org/x/tools/go/packages" "log" "os" "path/filepath" "slices" "testing" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "golang.org/x/tools/go/packages" "golang.org/x/tools/txtar" "github.com/crhntr/muxt/internal/source" diff --git a/name.go b/name.go index e427411..6fde532 100644 --- a/name.go +++ b/name.go @@ -191,6 +191,7 @@ func parseHandler(fileSet *token.FileSet, def *TemplateName, pathParameterNames def.call = call return nil } + func (tn TemplateName) callWriteHeader(receiverInterfaceType *ast.InterfaceType) bool { if tn.call == nil { return true diff --git a/routes.go b/routes.go index 75fbcc7..75ea440 100644 --- a/routes.go +++ b/routes.go @@ -842,7 +842,8 @@ func executeFuncDecl(imports *source.Imports, templatesVariableIdent string) *as Fun: &ast.SelectorExpr{X: ast.NewIdent(httpResponseField(imports).Names[0].Name), Sel: ast.NewIdent("WriteHeader")}, Args: []ast.Expr{ast.NewIdent("code")}, }}, - }}}, + }}, + }, &ast.AssignStmt{ Lhs: []ast.Expr{ast.NewIdent("_"), ast.NewIdent("_")}, Tok: token.ASSIGN,