dividing deps into two categories:
python: setup.py -> tests_require
eg: https://github.com/psf/requests/blob/3.0/setup.py#L126
node.js: package.json -> devDependencies
eg: https://github.com/expressjs/express/blob/4.18/package.json#L62
go.mod:
module github.com/{namespace}/dbdriver-wrapper
go 1.13
// for biz
require (
...
)
// for unittest
testRequire (
github.com/stretchr/testify v1.6.1
github.com/mattn/go-sqlite3. v2.0.3
)
Do you propose any behavioural differences between the two or is this just a cosmetic grouping?
Python and Node need to know the difference between the two in order to decide what becomes part of the build artifacts, while Go does not.
To clarify why Go doesn't, it's because, unlike with NPM and similar languages, the go.mod file does _not_ specify a module's dependencies. It specifies what versions of dependencies are needed. The import statements in the Go files are the ones that actually specify dependencies, so test dependencies are automatically sorted by virtue of being imported only from test files.
Duplicate of https://github.com/golang/go/issues/26913.
Most helpful comment
To clarify why Go doesn't, it's because, unlike with NPM and similar languages, the
go.modfile does _not_ specify a module's dependencies. It specifies what versions of dependencies are needed. Theimportstatements in the Go files are the ones that actually specify dependencies, so test dependencies are automatically sorted by virtue of being imported only from test files.