17 Commits

Author SHA1 Message Date
jholdstock
1720fd2062 ci: Simplify run_test.sh script.
Run tests and linters against a hard-coded set of local submodules
instead of attempting to find submodules dynamically.

While this has the obvious drawback of needing to manually update the
list of submodules, it greatly simplifies the script by removing a bunch
of regexes and string manipulation. This trade-off seems worthwhile
because the list of submodules in this repo will not be something which
changes often.

This change makes the script less brittle because it is hard-coded to
always run against the local code, regardless of any changes to module
versionining or project dependencies.
2024-05-29 11:02:29 +01:00
jholdstock
57864ae58f main: POSIX compliant shebang for locating bash.
Improve portability of run_tests.sh and harness.sh by using the POSIX
compliant shebang for locating bash.
2023-09-19 17:59:07 +01:00
Jamie Holdstock
c9f3573d8b build: Only invoke tests once.
`go test $ROOTPATH/...` runs all tests in the root module, and all tests in
submodules, so there is no need to run `go test` in the loop which
descends into submodule directories. Doing this actually causes each
test file to be run twice because the first iteration of the loop *is* the root
module, and thus all tests.

Only the linter needs to be invoked from each module directory.
2022-11-26 09:46:36 +08:00
Jamie Holdstock
42d91752f5 build: Rename root pkg path vars.
This renames the variables in the script that runs tests against all
modules to better reflect reality as of the latest versions of Go.

In particular, instead of referring to `ROOTPATH`, it now uses `ROOTPKG`
to better indicate that it is the name of root package as opposed to a
file path to it.
2022-11-26 09:46:36 +08:00
Jamie Holdstock
ed1fac1a2a
Add types module for API requests/responses/errors. (#356)
* Remove helper func getCommitmentAddress.

This function is only used in one place so removing it does not introduce any duplication. Removing the func also removes the need for errors.Is comparison, which will be very useful in upcoming changes.

* Rename apiError to ErrorCode.

* Don't use inline type for API errors.

* Export webapi errors.

* Export webapi request/responses.

* Add types module for API requests/responses/errors
2022-11-18 15:06:47 -05:00
jholdstock
2d67a35ba5 Use golangci-lint GitHub action.
- Rather than manually downloading and invoking golangci-lint, use the GitHub
action provided by the developers.
- Configure golangci with a config file rather than passing command line args.
This enables the same config to be used locally and on CI without introducing
duplication. It also allows much more flexibililty in configuration than using
CLI args alone.
2022-03-21 14:49:40 +00:00
Jamie Holdstock
83253f3c19
Use go 1.16 features (#292)
* Use features from Go 1.16 tooling.

- GO111MODULE environment variable now defaults to "on"
- "go build" and "go test" now exit with an error rather than silently modifying go.mod or go.sum files
- Update README.md

* Don't use deprecated ioutil package.
2021-08-26 09:29:43 -05:00
Jamie Holdstock
136e389f95 Update to golangci-lint 1.40.1.
Linter `golint` has been deprecated and replaced with `revive`.
2021-05-23 11:37:54 +08:00
jholdstock
4a207b15f8 Add missing copyright notices 2020-08-19 20:22:12 +00:00
jholdstock
94f9031dcb Fail build if go mod tidy/download changes 2020-07-09 21:01:40 +00:00
jholdstock
9d6cf57219 Add funcName to web api logs 2020-06-25 15:45:01 +00:00
Jamie Holdstock
5c1c19844c
Error logging for API methods (#28) 2020-05-19 10:55:25 +01:00
Jamie Holdstock
6ca2f620b7
Use a waitgroup to wait for shutdown tasks (#21) 2020-05-18 09:05:10 +01:00
Jamie Holdstock
7c5ab7ebae
Add basic HTML page and project license (#15) 2020-05-15 16:07:26 +01:00
Jamie Holdstock
57dfc1ed6d
Add decred logging and config (#8) 2020-05-14 19:02:45 +01:00
jholdstock
5da8d9238b Temporarily disable linter 2020-05-14 14:00:18 +01:00
Jamie Holdstock
b45bbf8896
Enable CI through GitHub Actions (#4) 2020-05-14 13:53:48 +01:00