Commit graph

288 commits

Author SHA1 Message Date
adisbladis
3e9c89c6dc
Merge pull request #79 from adisbladis/no-vet-lint
don't run vet linter
2022-08-24 15:57:35 +12:00
adisbladis
ac99f239a5 don't run vet linter
This is a port of 5b76f42372.
2022-08-24 11:34:30 +08:00
adisbladis
5d07a6931c Bump version to 1.1.0 2022-08-24 10:22:09 +08:00
adisbladis
1e45ba4683
Merge pull request #78 from adisbladis/nixpkgs-pr-notes
Implement notes from nixpkgs pr #188035
2022-08-24 14:20:36 +12:00
adisbladis
659c2ad32d Remove linkerd test
It takes too long in CI and doesn't exercise any code paths not already tested by other tests.
2022-08-24 10:17:09 +08:00
adisbladis
4141b461c4 builder/symlink.go: Remove commented code 2022-08-24 09:51:55 +08:00
adisbladis
f3314213be Add ldflags to buildGoApplication function signature
This is not strictly required but is good for discoverability.
2022-08-24 09:51:55 +08:00
adisbladis
564d1edc26 Set SSL_CERT_FILE by setup hook rather than explicit 2022-08-24 09:51:55 +08:00
adisbladis
b40e660f51 don't set trimpath for tests
This is a port of 64e6cc1a1d.
2022-08-24 09:41:59 +08:00
adisbladis
a1ab7d6ed6
Merge pull request #76 from adisbladis/unit-test-subdirs
Run unit tests under subdirs
2022-08-24 13:07:21 +12:00
adisbladis
ab5ec79935 Run unit tests under subdirs
Bug:
Due to the way `buildGoDir` function was repurposed to also run `go
test`, if `checkFlags` was defined, `go test` was ran only at the top
level directory. Only the first element of `checkFlags` array would get
passed to the `go test` command as arguments.

Fix:
Now the first parameter to `buildGoDir` is handled as the command.  If
the command is "test" `checkFlags` get passed as arguments along with
other build flags like ldflags, tags, etc.

Readability:
- Iteratively build a flag array in `buildGoDir` instead of single long
  variable expansion command line.
- Bash style: Single line local assignment of positional parameters.

This is a port of 89864413b2.
2022-08-24 09:00:33 +08:00
adisbladis
8054136f81
Merge pull request #75 from adisbladis/no-ln-cp
Copy vendor directory instead of symlinking to them
2022-08-24 12:20:48 +12:00
adisbladis
4d9ea46f79 Copy vendor directory instead of symlinking to it
As pointed out in
https://github.com/NixOS/nixpkgs/pull/188035#discussion_r953044264
this can be a source of errors when builders do things they shouldn't.

I'm not really happy about this change as it causes quite a bit more
IO for larger dependency graphs.
2022-08-24 08:05:37 +08:00
adisbladis
db17a7914d
Merge pull request #74 from adisbladis/generic-builder
Refactor to generic builder expression
2022-08-23 22:53:33 +08:00
adisbladis
4a59ba5a69 Refactor to generic builder expression
This will make nixpkgs dumps (ie dumping gomod2nix into nixpkgs) easier going forward.
2022-08-23 22:48:09 +08:00
adisbladis
338342f107 Bump version to 1.0.0 2022-08-23 21:30:33 +08:00
adisbladis
26d81380a1
Merge pull request #73 from adisbladis/mkgoenv-compiler
Fix Go compiler missing from mkGoEnv created environments
2022-08-23 21:16:44 +08:00
adisbladis
bca2a1231e Fix Go compiler missing from mkGoEnv created environments
Closes #68
2022-08-23 21:11:28 +08:00
adisbladis
b8c2216317 builder/install.go: Make build failures more apparent by attaching stdout/stderr 2022-08-17 15:36:21 +08:00
adisbladis
78068d481c
Merge pull request #69 from yihuang/master
requires a newer Apple SDK on macOS
2022-08-11 18:43:00 +08:00
adisbladis
d1e95112bd
Merge pull request #70 from yihuang/fix-regex
fix: Invalid regex on macOS
2022-07-29 22:44:54 +08:00
HuangYi
71fd703317
Invalid regex on macOS
- fix the regex
2022-07-29 19:38:34 +08:00
HuangYi
2be74ae917
Merge remote-tracking branch 'fork/master' 2022-07-21 09:48:00 +08:00
HuangYi
50385ada23
requires a newer Apple SDK on macOS 2022-07-21 09:40:17 +08:00
HuangYi
598c5ab1a6
requires a newer Apple SDK on macOS 2022-07-20 12:05:59 +08:00
adisbladis
40d32f82fc
Merge pull request #65 from adisbladis/minor-builder-refactor
Minor builder refactor
2022-06-15 06:21:49 +08:00
adisbladis
0ea20c514a refactor: inherit lib/builtins in top level scope in builder 2022-06-15 06:14:59 +08:00
adisbladis
85eaf382e6 refactor: Move replace commands computation to mkVendorEnv
It should be shared between shell envs and packages.
2022-06-15 06:14:59 +08:00
adisbladis
197bc13f6a
Merge pull request #64 from adisbladis/1.0.0-rc1
Set version to 1.0.0-rc1
2022-06-14 21:03:15 +08:00
adisbladis
6b1386b0ba Set version to 1.0.0-rc1 2022-06-14 20:58:13 +08:00
adisbladis
0a790b6075
Merge pull request #63 from adisbladis/let-package-remove
buildGoApplication: Remove package from let binding
2022-06-14 20:51:16 +08:00
adisbladis
74a2950c64 buildGoApplication: Remove package from let binding
It's the thing we return so no point in binding it to a temporary variable.
2022-06-14 19:27:24 +08:00
adisbladis
896c05d90b
Merge pull request #62 from adisbladis/nixpkgs-buildgomodule-ports-2022-06-14
Port changes to buildGoModule from nixpkgs
2022-06-14 19:19:58 +08:00
adisbladis
5a8afd711e builder: Reformat with nixpkgs-fmt
After porting builder changes from nixpkgs the structure has changed somewhat.
2022-06-14 19:14:19 +08:00
adisbladis
2028c2f3ff go: Apply package exclusion equally
The exclusion logic was moved out of getGoDirs but only buildPhase was updated
causing checkPhase to possibly fail. This happened in golint as it has go
files in testdata that are meant as testdata files and not go packages to
test which caused the checkPhase to fail.

This is a port of ddcc7c67d2
2022-06-14 19:14:19 +08:00
adisbladis
df791b8057 go: Drop unnecessary backslash-escape
There's no backslash interpretation going on within single-quote strings
which means there's no need to escape the backslash. Since this was going
on within single-quote strings the $exclude variable ended up having 2
backslashes (`\\`) instead of the intended single backslash. This meant
that the regex that was built up was incorrect. For example prometheus'
exclude contents before and after this change are:

✕: \(/_\|examples\|Godeps\|testdata\\|documentation/prometheus-mixin\)
✓: \(/_\|examples\|Godeps\|testdata\|documentation/prometheus-mixin\)

This is a port of 60543c4f9e
2022-06-14 19:14:19 +08:00
adisbladis
31102e0753 go: Bunch of fixes when using excludedPackages and other bits
Few things going on in this commit:

Do not print "Building subPakage $pkg" message if actually going to skip the
package. This was confusing to me when I was trying to figure out how to set
excludedPackages and seeing the "Building subpackage $pkg" messages for
packages I wanted to skip. Turns out this messages was being printed before
checking if we actually wanted to build the package and not necessarily that my
excludedPackages was wrong.

This commit also does some setup outside the buildGoDir function so that we
avoid checking `excludedPackages` for every package and cut down the number
of grep calls by half since we always want at least one grep for the default
excludedPackages, might as well just add to the patterns being checked.

Finally, adds documentation for usage of excludedPackages and subPackages. I
had to read the implementation to figure out how to correctly use these
function arguments since there was no documentation and different uses in the
code base. So this commit documents usage of the arguments.

This is a port of 8b5a7940b0
2022-06-14 19:14:19 +08:00
adisbladis
359449a284 buildGoApplication: warn if buildFlagsArray is used
This is a port of 3360a376cb
2022-06-14 19:14:19 +08:00
adisbladis
8aa44afb7e buildGoApplication: warn if buildFlags is used
This is a port of cb7d80dcaf
2022-06-14 19:14:19 +08:00
adisbladis
f42a0cddb4 buildGoApplication: add tags argument
Simpler method of setting tags rather than using some combination of buildFlags, buildFlagsArray, preBuild, etc

Using `lib.concatStringsSep ","` as space separated tags are deprecated in go.

This is a port of b60dde0c1e
2022-06-14 19:14:19 +08:00
adisbladis
5913cf95d5 buildGoApplication: add support for checkFlags
This is a port of dc973241a9
2022-06-14 19:14:19 +08:00
adisbladis
24c5e41124 buildGoApplication: Introduce ldflags argument
Previously it was not possible to define multiple ldflags, since only
the last definition applies, and there's some quoting issues with
`buildFlagsArray`. With the new `ldflags` argument it's possible to do
this, e.g.

    ldflags = drv.ldflags or [] ++ [
      "-X main.Version=1.0"
    ]

can now properly append a flag without clearing all previous ldflags.

This is a port of 155ae682a5
2022-06-14 19:14:19 +08:00
adisbladis
c5da508f3c
Merge pull request #61 from adisbladis/nix-reference-docs
Add Nix reference docs
2022-06-14 18:31:10 +08:00
adisbladis
ff1f766e83 README: Add link to Nix reference docs 2022-06-14 18:26:50 +08:00
adisbladis
e3745a9b6f docs: Add Nix API reference docs 2022-06-14 18:26:50 +08:00
adisbladis
366c0e5a17 mkGoEnv: Pass attrs on to mkDerivation 2022-06-14 18:26:50 +08:00
adisbladis
aa90002013
Merge pull request #60 from adisbladis/getting-started-docs
Add getting started docs
2022-06-14 18:07:37 +08:00
adisbladis
c6aa07b58f README: Add reference to the announcement blog post 2022-06-14 18:02:02 +08:00
adisbladis
219f2b41a1 Github actions: Bump install-nix-action 2022-06-14 17:58:17 +08:00
adisbladis
c6bc2d55a2 Add link to getting started docs in README 2022-06-14 17:55:59 +08:00