生成后删除.a文件-GoLang

I'm currently using fresh to rebuild and restart the webserver on every change of any of the source files in my project.

It works ok. However, after some time files are created at pkg directory. This causes the refresh does not happens anymore, and the reason is instead of getting the source files (.go files) to build the binary, it gets the .a files. How can I avoid this feature?

Adding information:

File: runner.conf at the same level of main.go

root: .
tmp_path: ./tmp
build_name: bin/app.bin
build_log: runner-build-errors.log
valid_ext: .go, .tpl, .tmpl, .html
build_delay: 600
colors: 1
log_color_main: cyan
log_color_build: yellow
log_color_runner: green
log_color_watcher: magenta
log_color_app:
ignore_dirs: ./pkg

Is not working at all:

13:39:48 watcher     | Watching .
13:39:48 watcher     | Watching bin
13:39:48 watcher     | Watching pkg
13:39:48 watcher     | Watching pkg/darwin_amd64
13:39:48 watcher     | Watching public
13:39:48 watcher     | Watching src
13:39:48 watcher     | Watching src/site.org
13:39:48 watcher     | Watching src/site.org/application
13:39:48 watcher     | Watching src/site.org/application/controllers
13:39:48 watcher     | Watching src/site.org/application/controllers/web
13:39:48 watcher     | Watching src/site.org/system

FIXING

In the end, I was not able to make it work. However, I create a solution using this plugin:

https://github.com/alexnj/SublimeOnSaveBuild

That tries to build on save, and I've created this build system (called GoLang):

{
    "shell_cmd": "sh /Users/acruz/go_projects/build_go.sh \"$project_path\"",
    "working_dir": "${project_path}"
}

And the file build_go.sh is:

#!/bin/sh
echo "Removing PKG folder if exists"
rm -Rf pkg

echo "Building application"
go build -o bin/app.bin main.go

echo "Killing application"
killall app.bin

echo "Running application ./bin/app.bin"
echo ""
echo "Debug information:"
echo ""

./bin/app.bin

One @TODO will be defining in the project configuration the name of the binary... but for me this works ok. One of the benefits of doing this is you don't have to add the -a flag, which will make slow the compilation process, and the debug information will be showed just there in the build window...

Debug information

You can change $GOPATH/src/github.com/pilu/fresh/runner/build.go#L13

cmd := exec.Command("go", "build", "-o", buildPath(), root())

to be

cmd := exec.Command("go", "build", "-a", "-o", buildPath(), root())

and then

go install -a github.com/pilu/fresh

flag -a force recompiling of .a files

Considering Pull Request 20 was about "Added ignore_dirs setting", you could use that new setting to explicitly ignore the pkg folder.

ignore_dirs path1, path2, ...

Check how that ignore_dirs path is checked:

if info.IsDir() && !isTmpDir(path) {
    if _, ignore := ignorePaths[info.Name()]; (len(path) > 1 && 
       strings.HasPrefix(filepath.Base(path), ".")) || ignore {
        return filepath.SkipDir