File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ module github.com/caixw/gobuild
22
33require (
44 github.com/fsnotify/fsnotify v1.7.0
5- github.com/issue9/assert/v4 v4.3.0
5+ github.com/issue9/assert/v4 v4.3.1
66 github.com/issue9/localeutil v0.27.2
77 github.com/issue9/source v0.11.5
88 github.com/issue9/term/v3 v3.3.1
Original file line number Diff line number Diff line change 11github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA =
22github.com/fsnotify/fsnotify v1.7.0 /go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM =
3- github.com/issue9/assert/v4 v4.3.0 h1:W3XDKmttsfzihYGxJ9rJoL2ViJgWERB9IxfHcxjv65U =
4- github.com/issue9/assert/v4 v4.3.0 /go.mod h1:v7qDRXi7AsaZZNh8eAK2rkLJg5/clztqQGA1DRv9Lv4 =
3+ github.com/issue9/assert/v4 v4.3.1 h1:dHYODk1yV7j/1baIB6K6UggI4r1Hfuljqic7PaDbwLg =
4+ github.com/issue9/assert/v4 v4.3.1 /go.mod h1:v7qDRXi7AsaZZNh8eAK2rkLJg5/clztqQGA1DRv9Lv4 =
55github.com/issue9/errwrap v0.3.2 h1:7KEme9Pfe75M+sIMcPCn/DV90wjnOcRbO4DXVAHj3Fw =
66github.com/issue9/errwrap v0.3.2 /go.mod h1:KcCLuUGiffjooLCUjL89r1cyO8/HT/VRcQrneO53N3A =
77github.com/issue9/localeutil v0.27.2 h1:RkFLlDS/0W/YEIUUPyokdtegTp+DFMZ7/iR1V9OHUQg =
Original file line number Diff line number Diff line change 99 "io/fs"
1010 "os"
1111 "path/filepath"
12+ "runtime"
1213 "strings"
1314 "time"
1415
@@ -84,8 +85,8 @@ func (opt *Options) sanitize() (err error) {
8485 }
8586 // BUG: 如果获得的 opt.wd == /,那么 appName 将是个非法值。
8687 opt .appName = filepath .Join (opt .wd , filepath .Base (opt .wd ))
87- if goexe := os . Getenv ( "GOEXE" ); goexe != " " {
88- opt .appName += goexe
88+ if runtime . GOOS == "windows " {
89+ opt .appName += ".exe"
8990 }
9091
9192 // 根据 wd 获取项目根目录,从而拿到需要监视的列表
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ package watch
66
77import (
88 "path/filepath"
9+ "runtime"
910 "strings"
1011 "testing"
1112
@@ -21,7 +22,12 @@ func TestOptions_sanitize(t *testing.T) {
2122 opt .MainFiles = "./"
2223 a .NotError (opt .sanitize ()).
2324 Equal (opt .WatcherFrequency , MinWatcherFrequency ).
24- True (strings .HasSuffix (opt .appName , "watch" ))
25+ When (runtime .GOOS == "windows" , func (a * assert.Assertion ) {
26+ a .True (strings .HasSuffix (opt .appName , "watch.exe" ))
27+ }).
28+ When (runtime .GOOS != "windows" , func (a * assert.Assertion ) {
29+ a .True (strings .HasSuffix (opt .appName , "watch" ))
30+ })
2531
2632 opt .Excludes = []string {}
2733 a .NotError (opt .sanitize ())
You can’t perform that action at this time.
0 commit comments