21 Commits

Author SHA1 Message Date
Abhinav Gupta 9f71a49767 ci: Test with Go 1.23 and 1.24 (#502)
In CI, test with Go 1.23 and 1.24,
and upgrade the Hermit-managed Go and golangci-lint to latest versions.

The new golangci-lint had a number of warnings and minor issues
that were either fixed or opted-out of.
2025-02-17 14:10:57 +11:00
Alec Thomas 7747b4146b Revert "Load environment variables as a resolver (#480)"
This reverts commit 3cedc44821.

Fixes #497, #498
2025-02-13 11:17:47 -08:00
Maxime Vidori 3cedc44821 Load environment variables as a resolver (#480) 2025-02-10 09:53:27 +11:00
Alec Thomas a32b94b705 chore: interface{} -> any 2024-12-29 08:10:34 +09:00
Alec Thomas 2ad9498bdf chore: bump go + golangci-lint 2024-08-20 08:16:24 +10:00
Abhinav Gupta a86bda490b golangci-lint: Upgrade, fix issues (#397)
The golangci-lint being used was quite dated.
This change upgrades to the latest version.
Adds and updates exclusions based on new failures.

Note on revive:
I've included an opt-out for unused parameters for revive
because turning `newThing(required bool)` to `newThing(_ bool)`
is a loss of useful information.

The changes to the Go files are to fix the following issues:

```
camelcase.go:16: File is not `gofmt`-ed with `-s` (gofmt)
config_test.go:50:18: directive `//nolint: gosec` is unused for linter "gosec" (nolintlint)
defaults_test.go:28:25: G601: Implicit memory aliasing in for loop. (gosec)
doc.go:5: File is not `gofmt`-ed with `-s` (gofmt)
kong.go:446:18: directive `//nolint: gosec` is unused for linter "gosec" (nolintlint)
kong_test.go:503:20: G601: Implicit memory aliasing in for loop. (gosec)
model.go:493:10: composites: reflect.ValueError struct literal uses unkeyed fields (govet)
scanner.go:112: File is not `gofmt`-ed with `-s` (gofmt)
```

And to address broken nolint directives reported as follows by
golangci-lint.

```
[.. skipped .. ]
tag.go:65:1: directive `// nolint:gocyclo` should be written without leading space as `//nolint:gocyclo` (nolintlint)
tag.go:206:51: directive `// nolint: gocyclo` should be written without leading space as `//nolint: gocyclo` (nolintlint)
util_test.go:23:43: directive `// nolint: errcheck` should be written without leading space as `//nolint: errcheck` (nolintlint)
util_test.go:51:22: directive `// nolint: errcheck` should be written without leading space as `//nolint: errcheck` (nolintlint)
```
2023-12-11 09:37:07 +11:00
Alec Thomas d974d7270a feat: add support for camelCase JSON keys 2022-11-13 10:16:22 +11:00
Evgeny 8b2821cc24 Added sub objects support in JSON resolver (#178) 2021-06-21 21:08:43 +10:00
Alec Thomas 6cebaa7b85 Hermitise and bump golangci-lint. 2021-06-09 12:48:47 +10:00
Alec Thomas 439c674f7a Use interface{} instead of string in tokens.
This allows the scanner and resolvers to pass Go types around rather
than having to serialise/deserialise to/from strings.
2019-04-24 23:25:13 +10:00
Alec Thomas 886c2d7b01 Better help for maps. 2019-01-12 20:59:24 +11:00
Alec Thomas c935ea07dd Fix some more Resolver changes. 2018-09-21 17:13:37 +10:00
Alec Thomas c112a076e7 Convert resolvers to an interface with a Validate() method. 2018-09-21 16:23:50 +10:00
Alec Thomas 3a832f8343 Treat envars as higher priority than resolvers. 2018-09-21 12:11:52 +10:00
Alec Thomas 653531d6bc Start making help slightly configurable. 2018-06-20 21:55:39 +10:00
Alec Thomas 662ace41c5 Move separator defaulting back into Tag. 2018-06-13 22:58:53 +10:00
Alec Thomas ecf21e4cc9 Add support for maps. 2018-06-13 22:17:28 +10:00
Alec Thomas 232faad0a0 Add configuration loading + docs + linter fixes. 2018-06-13 10:34:19 +10:00
Alec Thomas a5c97373ba Remove automatic envar naming resolver. 2018-06-13 08:40:41 +10:00
Alec Thomas 0fb3de514f Add a default-enabled EnvResolver for the env tag. 2018-06-12 23:27:58 +10:00
Alec Thomas e9d88d6528 Implement flag "resolvers". (#24)
* Propagate errors.
* Use junit test output.
* Expand role of DecodeContext to include Scanner.
* Inject resolved flags as Path elements in the Context.
  This allows all existing logic to apply seamlessly: hooks, required
flags, etc.
* Clarify that hooks can be called multiple times.
2018-06-12 07:20:55 +10:00