Format the code with gofumpt to prevent my IDE from reformatting
every time I open a file. gofumpt provides a superset of gofmt,
so should not impact users that are not using gofumpt.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
pkg/watch/watcher_darwin.go:96:16: Error return value of `d.stream.Start` is not checked (errcheck)
d.stream.Start()
^
pkg/prompt/prompt.go:97:12: Error return value of `fmt.Fprint` is not checked (errcheck)
fmt.Fprint(u.stdout, message)
^
pkg/prompt/prompt.go:99:12: Error return value of `fmt.Scanln` is not checked (errcheck)
fmt.Scanln(&answer)
^
cmd/formatter/logs.go:118:15: Error return value of `fmt.Fprintf` is not checked (errcheck)
fmt.Fprintf(w, "%s%s%s\n", p.prefix, timestamp, line)
^
cmd/formatter/logs.go:120:15: Error return value of `fmt.Fprintf` is not checked (errcheck)
fmt.Fprintf(w, "%s%s\n", p.prefix, line)
^
pkg/progress/json.go:67:15: Error return value of `fmt.Fprintln` is not checked (errcheck)
fmt.Fprintln(p.out, string(marshal))
^
pkg/progress/json.go:87:15: Error return value of `fmt.Fprintln` is not checked (errcheck)
fmt.Fprintln(p.out, string(marshal))
^
pkg/progress/plain.go:47:14: Error return value of `fmt.Fprintln` is not checked (errcheck)
fmt.Fprintln(p.out, prefix, e.ID, e.Text, e.StatusText)
^
pkg/progress/tty.go:162:12: Error return value of `fmt.Fprint` is not checked (errcheck)
fmt.Fprint(w.out, b.Column(0).ANSI)
^
pkg/progress/tty.go:165:12: Error return value of `fmt.Fprint` is not checked (errcheck)
fmt.Fprint(w.out, aec.Hide)
^
pkg/compose/attach.go:53:13: Error return value of `fmt.Fprintf` is not checked (errcheck)
fmt.Fprintf(s.stdout(), "Attaching to %s\n", strings.Join(names, ", "))
^
pkg/compose/compose.go:194:6: emptyStringTest: replace `len(dependencies) > 0` with `dependencies != ""` (gocritic)
if len(dependencies) > 0 {
^
pkg/compose/convergence.go:461:2: builtinShadow: shadowing of predeclared identifier: max (gocritic)
max := 0
^
pkg/compose/run.go:127:5: emptyStringTest: replace `len(opts.User) > 0` with `opts.User != ""` (gocritic)
if len(opts.User) > 0 {
^
pkg/compose/run.go:139:5: emptyStringTest: replace `len(opts.WorkingDir) > 0` with `opts.WorkingDir != ""` (gocritic)
if len(opts.WorkingDir) > 0 {
^
pkg/compose/viz.go:91:8: emptyStringTest: replace `len(portConfig.HostIP) > 0` with `portConfig.HostIP != ""` (gocritic)
if len(portConfig.HostIP) > 0 {
^
cmd/compatibility/convert.go:66:6: emptyStringTest: replace `len(arg) > 0` with `arg != ""` (gocritic)
if len(arg) > 0 && arg[0] != '-' {
^
pkg/e2e/watch_test.go:208:25: printf: non-constant format string in call to gotest.tools/v3/poll.Continue (govet)
return poll.Continue(res.Combined())
^
pkg/e2e/watch_test.go:290:25: printf: non-constant format string in call to gotest.tools/v3/poll.Continue (govet)
return poll.Continue(r.Combined())
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The BuildKit dockerignore package was integrated in the patternmatcher
repository / module. This patch updates our uses of the BuildKit package
with its new location.
A small local change was made to keep the format of the existing error message,
because the "ignorefile" package is slightly more agnostic in that respect
and doesn't include ".dockerignore" in the error message.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Use latest Go minor release. Note: this release included fixes for
several CVEs, but they do not impact Compose.
Small errors have been fixed to keep the linter happy.
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Was getting segfaults with multiple services using
`x-develop` and `watch` at the same time. Turns out
the Moby path matcher lazily initializes the regex
pattern internally the first time it's used, so it's
not goroutine-safe.
Change here is to not use a global instance for the
ephemeral path matcher, but a per-watcher instance.
Additionally, the data race detector caught a couple
other issues that were easy enough to fix:
* Use the lock that's used elsewhere for convergence
before manipulating
* Eliminate concurrent map access when triggering
rebuilds
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Big change here is to import the ephemeral ignore set from Tilt.
The `.git` directory is also ignored for now: this restriction
should probably be lifted and made configurable in the future,
but it's not generally important to watch and triggers a LOT of
events (e.g. Git creates `index.lock` files that will appear and
disappear rapidly as terminals/IDEs/etc interact with Git, even
for read-only operations).
The Tilt-provided ephemeral file set has been slowly devised over
time based on temporary files that can cause trouble. We can also
look at a more robust/configurable solution here in the future,
but thse provide a reasonable out-of-the-box configuration for
the moment.
There's also some small tweaks to the output to add missing
newlines in a few edge cases and such.
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Currently the emacs ignore patterns include `**/.#*` (lock files), but
doesn't include `**/#*#` (autosave files;
https://www.emacswiki.org/emacs/AutoSave, not to be confused with
`**/*~` backup files which are ignored.)
Add autosave files.
When creating files in Go, the stdlib will create (and then rapidly
delete) files ending with `-go-tmp-umask` to determine the umask
to use for permission purposes.
This can cause trouble with Live Update because the files tend to
vanish underneath it, for example.
Fixes#5117.
`exportloopref` - detects captures of loop variable without
re-assignment
NOTE: There can be false negatives with this linter to avoid being
overly strict and annoying!
Also upgraded `golangci-lint` to latest (v1.43.0 published 2021-11-03).
I've been running the test suite (`./internal/engine` in particular)
with `-count X` a lot recently to catch timing-related test failures.
After running enough times, the tests start failing due to too many
open files, so I did an audit and found a few places where files or
readers weren't always being closed.
* lint: add make lintfix and run it
Fixes all errors like:
```
File is not `goimports`-ed with -local github.com/tilt-dev/tilt (goimports)
```
* git: change to use TrimSuffix
* build: remove unnecessary cast
`WalkDir` is new in Go 1.16 and avoids calling `os.Lstat` on
every visited file and directory. In most cases, we don't need
that info, so this will help reduce I/O when listing files,
which can be helpful for particularly big monorepos.
Unused code linter isn't particularly smart about platform build
tags, so since this func is only used by the "naive" (non-macOS)
file watcher, it needs to live with that or it gets flagged as
dead code when linting on macOS.
In most places in Tilt, we try to use absolute paths everywhere.
So this makes things more consistent with the rest of Tilt, and lets us be
a bit more flexible in how we handle subdirs and parent dirs in ignores.
Fixes https://github.com/tilt-dev/tilt/issues/3740