いきなりDocker化すると、動きがわからず、
ハマる可能性大なので一回ローカルで試すのが吉と思う
コンパイルの出力先ファイル名になんでもいいから拡張子つけないとダメ。
windowsなので、exeをつけた。
commands:
install:
status: true
method: go build -o app.exe
run:
status: true
method: ./app.exe
そうしないと。このエラー
$ realize start
[15:10:53][GO_DEMO2] : Watching 2 file/s 0 folder/s
[15:10:53][GO_DEMO2] : Install started
[15:10:57][GO_DEMO2] : Install completed in 3.978 s
[15:10:57][GO_DEMO2] : Running..
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x8 pc=0x4d006d]
goroutine 52 [running]:
os.(*Process).signal(0x0, 0xa58520, 0xd9a4c0, 0xc000214020, 0xc00007af70)
c:/go/src/os/exec_windows.go:59 +0x2d
os.(*Process).Signal(...)
c:/go/src/os/exec.go:131
github.com/oxequa/realize/realize.(*Project).run.func1(0xc00007b6a8)
C:/Users/N10W78/go/src/github.com/oxequa/realize/realize/projects.go:581 +0x64
github.com/oxequa/realize/realize.(*Project).run(0xc00005e300, 0xc000019650, 0x5, 0xc00020a180, 0xc000058420, 0xa53d40, 0xc0002020c0)
C:/Users/N10W78/go/src/github.com/oxequa/realize/realize/projects.go:646 +0xc62
github.com/oxequa/realize/realize.(*Project).Reload.func3(0xc00005e300, 0xc00020a180, 0xc000058420)
C:/Users/N10W78/go/src/github.com/oxequa/realize/realize/projects.go:262 +0x14e
created by github.com/oxequa/realize/realize.(*Project).Reload
C:/Users/N10W78/go/src/github.com/oxequa/realize/realize/projects.go:260 +0x29e
また、Goでwebサーバしている場合、プロセスを殺してやらないと、実行ファイルが上書きされず
ホットリロードされなかった。
macやlinuxならいけるのだろうか。。。今後調査 ・・・追記Linux上なら何事もない
scripts:
- type: before
command: taskkill /F /im app.exe
realize.yml サンプル
settings:
legacy:
force: true
interval: 0s
schema:
- name: realize
path: .
args:
- main.go
commands:
install:
status: true
method: go build -o app.exe
run:
status: true
method: ./app.exe
watcher:
extensions:
- go
paths:
- /
scripts:
- type: before
command: taskkill /F /im app.exe
ignored_paths:
- .git
- .realize
- vendor