fix: allow library to initialize without config and fix lefthook lint flag
- Default to empty Config in NewLibrary when nil is passed, so Wails binding generation succeeds without a config file on disk. - Fix golangci-lint v2 flag in lefthook (--build-tags, not -tags). - Run golangci-lint on full project instead of individual staged files.
This commit is contained in:
@@ -32,6 +32,8 @@ type Library struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewLibrary creates a new library with the given configuration.
|
// NewLibrary creates a new library with the given configuration.
|
||||||
|
// A nil config is permitted; the library will be inert until a valid
|
||||||
|
// configuration is supplied via the LibraryConfigChanged event.
|
||||||
func NewLibrary(
|
func NewLibrary(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
logger *slog.Logger,
|
logger *slog.Logger,
|
||||||
@@ -39,7 +41,7 @@ func NewLibrary(
|
|||||||
db *database.DB,
|
db *database.DB,
|
||||||
) (*Library, error) {
|
) (*Library, error) {
|
||||||
if conf == nil {
|
if conf == nil {
|
||||||
return nil, errors.New("nil config for library")
|
conf = &Config{}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := conf.Validate(); err != nil {
|
if err := conf.Validate(); err != nil {
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ pre-commit:
|
|||||||
|
|
||||||
golangci-lint:
|
golangci-lint:
|
||||||
glob: "*.go"
|
glob: "*.go"
|
||||||
run: golangci-lint run --timeout 5m -tags webkit2_41 {staged_files}
|
run: golangci-lint run --timeout 5m --build-tags webkit2_41 ./...
|
||||||
|
|
||||||
codegen-check:
|
codegen-check:
|
||||||
glob: "*.{go,sql,templ}"
|
glob: "*.{go,sql,templ}"
|
||||||
|
|||||||
Reference in New Issue
Block a user