Compare commits

...

7 Commits

Author SHA1 Message Date
Andrey Nering
f8545d4c61 v3.4.2 2021-04-23 18:11:31 -03:00
Oleg Butuzov
9b42ef5d46 "file does not exist" improving for watchers
Adds additional (initial missing) context to the go generic
`os.ErrNotExist` error, in addition to other errors that (possibly)
can be returned by `zglob.Glob`

Closes #472
2021-04-23 18:03:49 -03:00
Andrey Nering
05ddfc0495 Merge pull request #476 from Pix4D/fix-os-kill
signals: do not try to catch uncatchable signals
2021-04-23 17:45:56 -03:00
Andrey Nering
53b2cebb66 Updated the version output to use Go module build information if avalable. Enabled GoReleaser module proxying for verifiable builds.
Co-authored-by: Jamie Edge <JamieEdge@users.noreply.github.com>
Co-authored-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2021-04-23 17:35:15 -03:00
Marco Molteni
837fb71a24 signals: do not try to catch uncatchable signals
os.Kill is SIGKILL (kill -9), cannot be intercepted.
(see https://github.com/golang/go/issues/13080)
2021-04-20 14:57:23 +02:00
Marco Molteni
2e13cf5f74 gitignore more editors 2021-04-20 14:54:24 +02:00
Andrey Nering
0ae1681d9c CHANGELOG: Fix typos 2021-04-17 17:57:08 -03:00
5 changed files with 44 additions and 9 deletions

3
.gitignore vendored
View File

@@ -19,8 +19,9 @@ dist/
.DS_Store .DS_Store
# intellij idea/goland # editors
.idea/ .idea/
.vscode/
# exuberant ctags # exuberant ctags
tags tags

View File

@@ -1,6 +1,6 @@
build: build:
binary: task binary: task
main: cmd/task/task.go main: cmd/task
goos: goos:
- windows - windows
- darwin - darwin
@@ -17,6 +17,11 @@ build:
goarch: 386 goarch: 386
env: env:
- CGO_ENABLED=0 - CGO_ENABLED=0
ldflags:
- -s -w # Don't set main.version.
gomod:
proxy: true
archives: archives:
- name_template: "{{.Binary}}_{{.Os}}_{{.Arch}}" - name_template: "{{.Binary}}_{{.Os}}_{{.Arch}}"

View File

@@ -1,13 +1,22 @@
# Changelog # Changelog
## v3.4.2 - 2021-04-23
- On watch, report which file failed to read
([#472](https://github.com/go-task/task/pull/472)).
- Do not try to catch SIGKILL signal, which are not actually possible
([#476](https://github.com/go-task/task/pull/476)).
- Improve version reporting when building Task from source using Go Modules
([#462](https://github.com/go-task/task/pull/462), [#473](https://github.com/go-task/task/pull/473)).
## v3.4.1 - 2021-04-17 ## v3.4.1 - 2021-04-17
- Improve error reporting when parsing YAML: in some situations where you - Improve error reporting when parsing YAML: in some situations where you
would just see an generic error, you'll now see the actual error with would just see an generic error, you'll now see the actual error with
more detail: the YAML line the failed to parse, for exemple more detail: the YAML line the failed to parse, for example
[#467](https://github.com/go-task/task/issues/467). ([#467](https://github.com/go-task/task/issues/467)).
- A JSON Schema was published [here](https://json.schemastore.org/taskfile.json) - A JSON Schema was published [here](https://json.schemastore.org/taskfile.json)
- and is automatically being used by some editors like Visual Studio Code and is automatically being used by some editors like Visual Studio Code
([#135](https://github.com/go-task/task/issues/135)). ([#135](https://github.com/go-task/task/issues/135)).
- Print task name before the command in the log output - Print task name before the command in the log output
([#398](https://github.com/go-task/task/pull/398)). ([#398](https://github.com/go-task/task/pull/398)).

View File

@@ -7,6 +7,7 @@ import (
"os" "os"
"os/signal" "os/signal"
"path/filepath" "path/filepath"
"runtime/debug"
"strings" "strings"
"syscall" "syscall"
@@ -19,7 +20,7 @@ import (
) )
var ( var (
version = "master" version = ""
) )
const usage = `Usage: task [-ilfwvsd] [--init] [--list] [--force] [--watch] [--verbose] [--silent] [--dir] [--taskfile] [--dry] [--summary] [task...] const usage = `Usage: task [-ilfwvsd] [--init] [--list] [--force] [--watch] [--verbose] [--silent] [--dir] [--taskfile] [--dry] [--summary] [task...]
@@ -93,7 +94,7 @@ func main() {
pflag.Parse() pflag.Parse()
if versionFlag { if versionFlag {
fmt.Printf("Task version: %s\n", version) fmt.Printf("Task version: %s\n", getVersion())
return return
} }
@@ -208,7 +209,7 @@ func getArgs() (tasksAndVars, cliArgs []string) {
func getSignalContext() context.Context { func getSignalContext() context.Context {
ch := make(chan os.Signal, 1) ch := make(chan os.Signal, 1)
signal.Notify(ch, os.Interrupt, os.Kill, syscall.SIGTERM) signal.Notify(ch, os.Interrupt, syscall.SIGTERM)
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
go func() { go func() {
sig := <-ch sig := <-ch
@@ -217,3 +218,21 @@ func getSignalContext() context.Context {
}() }()
return ctx return ctx
} }
func getVersion() string {
if version != "" {
return version
}
info, ok := debug.ReadBuildInfo()
if !ok || info.Main.Version == "" {
return "unknown"
}
version = info.Main.Version
if info.Main.Sum != "" {
version += fmt.Sprintf(" (%s)", info.Main.Sum)
}
return version
}

View File

@@ -2,6 +2,7 @@ package task
import ( import (
"context" "context"
"fmt"
"os" "os"
"os/signal" "os/signal"
"path/filepath" "path/filepath"
@@ -129,7 +130,7 @@ func (e *Executor) registerWatchedFiles(w *watcher.Watcher, calls ...taskfile.Ca
for _, s := range task.Sources { for _, s := range task.Sources {
files, err := zglob.Glob(s) files, err := zglob.Glob(s)
if err != nil { if err != nil {
return err return fmt.Errorf("task: %s: %w", s, err)
} }
for _, f := range files { for _, f := range files {
absFile, err := filepath.Abs(f) absFile, err := filepath.Abs(f)