I enabled the golang backend and have a directory ...
# general
h
I enabled the golang backend and have a directory with some go files that I was expecting to get picked up by
tailor
.
tailor
seems to be satisfied with no build files for those files. Anything obvious I might be leaving out to get
tailor
to start finding my things?
1
If I make the build file myself, commands like
list
work as expected.
b
Looking at the source code (https://github.com/pantsbuild/pants/blob/25699f449caf6e73157026ccca5077682168d168/src/python/pants/backend/go/goals/tailor.py), it looks like the tailoring logic depends on
go.mod
files and
package main
contents. What's your (approximate) file structure? What's the manual
BUILD
that works for you?
h
Gotcha. I just made one directory with
my_file.go
inside and threw
tailor
at it. When nothing happened, I made a
BUILD
file with a single
go_package
entry.
I've never written go so lots of learning
b
I haven't written any either, so I'm only slightly helpful 🤷‍♂️ It sounds like for this first step, tailor is potentially doing nothing due to no
go.mod
file, whatever that file means!
h
Neat, adding
go.mod
at the top level made things happy
And for the naive like me coming along to this thread, it was incorrect to just
touch go.mod
. Instead, I deleted that and, at our monorepo root, I ran
go mod init <company name>
which had the proper populated file.
After that,
tailor
and
dependencies
worked like a charm!
🎉 1