I've hit a problem with building go executables when `.gitignore` tup
directive is active.
Specifically, it seems `go build` scans repository `.gitignore` files and
thus tup considers them as inputs that should be declared.
Example
```
pmoore@Peters-MacBook-Pro:~/tmp $ ls
Tupfile Tupfile.ini go.mod main.go
pmoore@Peters-MacBook-Pro:~/tmp $ cat Tupfile
.gitignore
: |> go build -o %o |> hello-world
pmoore@Peters-MacBook-Pro:~/tmp $ cat Tupfile.ini
pmoore@Peters-MacBook-Pro:~/tmp $ cat go.mod
module github.com/petemoore/tup-go-gitignore
go 1.15
pmoore@Peters-MacBook-Pro:~/tmp $ cat main.go
package main
import "fmt"
func main() {
fmt.Println("Hello World")
}
pmoore@Peters-MacBook-Pro:~/tmp $
```
Without the `.gitignore` directive in Tupfile, all is ok. However, with it,
we get:
```
* 0) go build -o hello-world
*** tup messages ***
tup error: Missing input dependency - a file was read from, and was not
specified as an input link for the command. This is an issue because the
file was created from another command, and without the input link the
commands may execute out of order. You should add this file as an input,
since it is possible this could randomly break in the future.
- [16] .gitignore
*** Command ran successfully, but failed due to errors processing input
dependencies.
[ ] 100%
*** tup: 1 job failed.
```
If I now add `.gitignore` as an order-only input, i.e.
```
pmoore@Peters-MacBook-Pro:~/tmp $ cat Tupfile
.gitignore
: | .gitignore |> go build -o %o |> hello-world
```
then instead I get:
```
* 0) [0.001s] .
tup error: Explicitly named file '.gitignore' in subdir '.' is scheduled to
be deleted (possibly the command that created it has been removed).
tup error: Error parsing Tupfile line 2
Line was: ': .gitignore |> go build -o %o |> hello-world'
[ ] 100%
*** tup: 1 job failed.
```
I'm not sure there is a way to prevent `go build` from scanning
`.gitignore` files in the repo, so I'm not sure how to overcome this. Any
ideas?
Many thanks!
Pete
P.S. I'm aware I could manage the .gitignore file myself, but as of go
1.17, it seems `go build` will scan all .gitignore files in the entire
repo, and that then means I would have to manage the .gitignore file in all
directories of my repo, which wouldn't be practical. So at the moment I'm
stuck with go1.16 which only seems to only scans the .gitignore file of the
directory the `go build` is issued in (or the go package(s) that are being
built).
--
--
tup-users mailing list
email: [email protected]
unsubscribe: [email protected]
options: http://groups.google.com/group/tup-users?hl=en
---
You received this message because you are subscribed to the Google Groups
"tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tup-users/9f6fb303-243e-412d-883e-f502d35d4843n%40googlegroups.com.