gravityblast / fresh Goto Github PK
View Code? Open in Web Editor NEWBuild and (re)start go web apps after saving/creating/deleting source files.
License: MIT License
Build and (re)start go web apps after saving/creating/deleting source files.
License: MIT License
By the looks of it, you don't listen for signals of process you are executing after build.
If there is some error afterwards, it doesn't do anything.
Listen for signals and restart app or exit pilu/fresh on app error to allow docker container to restart itself.
It's critical if used inside docker.
Hi,
It's not an issue, just to say that I'm using a docker container I've made and finally gave it to the community:
https://hub.docker.com/r/metal3d/go-fresh/
You may try, it works like a charm at home. It's nice to work with other containers as linked mongo database by docker-compose. I'm using "Glide" to get "vendor" directory in my project, no need to install them in the container now.
sometimes I switch database connection between different environment,but it won't rebuild.
fresh is neat thanks. Really liking golang
Its a tool, and so is not imported into my project code.
i use glide for vendoring. works well with golang 1.5 so far.
Now, my question is:
How can i ensure that fresh is installed as a tool for each project ?
One way is to make it a "cmd" in my project maybe... Not sure.
Hello.
At each re-build I'm getting an error:
remove tmp/runner-build-errors.log: no such file or directory
Indeed when I check the tmp/
folder there is binary named runner-build
.
Is this normal behavior? I'm on Mac Yosemite with Go 1.5.
Regards.
Hi there,
I'm using fresh
on Windows 10 inside a Docker container. fresh
seems to build the project correctly the first time, but on subsequent rebuilds will fail with go install github.com/me/project: open tmp/runner-build: no such file or directory
. If I bash into the container I can see tmp/runner-build
when listing the directory contents, but when trying to interact with it I get more no such file or directory
errors. My initial thought was that this is was a permission issue but it doesn't appear to be.
Not sure if this repo is too active anymore, but has anyone encountered this before?
Have a setting that can allow you to ignore some directories from being watched.
It can sometimes be the case that not all folders contents should force a reload of the entire application.
I am using Atom editor with other Golang plugins.
When I have a project directory open in sidebar, every time I open new file to edit by selecting from sidebar, fresh runs the rebuild process.
I tried with other text editors too, and every time a file is opened, fresh runs rebuild.
Can we restrict it to only save event of the file?
FYI, none of the editors have autosave or similar feature(s) enabled.
It could be fine to add the race detector by option (or even by default !)
Do you have any concerns regarding putting a build command in config file?
Default config would be "go", "build"..., but it would allow us to define "gb", "build".
It is already done for "run" command with build_name
.
I've seen that you're in the middle of refactoring so I am curious should I wait or create a PR anytime soon?
I cannot make Fresh work again after I deleted the tmp directory. It should generate the files again once I restart it, right? It doesn't!
I've noticed that in a project's folder with 0755 permissions where fresh is being run, tmp folder can't be created. Temporarily giving this folder 0777 solves the issue, but the tmp folder is creates from root:root user and group (and you can't anymore delete this folder if not root or sudo), so I guess that's the problem.
If I try to create tmp folder manually, fresh doesn't run with this folder as:
open tmp/runner-build: permission denied
Once again, I need to 0777 that folder even from my working user... But the runner-build file still belongs to root.
I'm seeing a strange bug where if I create an empty directory called public
in my project root, fresh outputs the following but never executes my application's main function:
app_1 | 16:33:50 runner | InitFolders
app_1 | 16:33:50 runner | mkdir ./tmp
app_1 | 16:33:50 runner | mkdir ./tmp: file exists
app_1 | 16:33:50 watcher | Watching .
app_1 | 16:33:50 watcher | Watching handlers
app_1 | 16:33:50 watcher | Watching models
app_1 | 16:33:50 watcher | Watching public
This doesn't happen if I create an empty directory with a different name.
Perhaps I would be able to use #19 as a work around if it were merged?
Looks like the building process take too lone time.
Do you guy has any suggest to overcome it?
It just painful to wait 8 seconds for a change ~
I am using a gin for simple test now.
14:21:03 watcher | sending event "./src/main.go": MODIFY|ATTRIB
14:21:03 main | receiving first event "./src/main.go": MODIFY|ATTRIB
14:21:03 main | sleeping for 600 milliseconds
14:21:03 watcher | sending event "./src/main.go": MODIFY
14:21:03 main | flushing events
14:21:03 main | receiving event "./src/main.go": MODIFY
14:21:03 main | Started! (23 Goroutines)
14:21:03 main | remove tmp/runner-build-errors.log: no such file or directory
14:21:03 build | Building...
14:21:11 runner | Running...
14:21:11 runner | Killing PID 200
14:21:11 main | --------------------
14:21:11 main | Waiting (loop 5)...
14:21:11 app | [GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode)
14:21:11 app | [GIN-debug] GET /ping --> main.setupRouter.func1 (3 handlers)
When encoding values, an error occurs. The value "@" is not encoded and just comes back with (MISSING). This was tested apart from fresh and it works correctly with go run
func test() {
v := url.Values{}
v.Set("email", "[email protected]")
log.Println(v.Encode())
}
Response using fresh:
email=test%!t(MISSING)est.com
Intended Response:
email=test%40test.com
I'm running fresh using martini and noticed that logs don't show until the project is rebuilt, how can I fix that?
I use https://github.com/valyala/quicktemplate for templating, which requires running a qtc command which generates go code from templates to be included before the build. Is there a way to specify a "prestep" or custom build command to have qtc run before every reload?
As title, i set log_color_app = blue
, yet my application log text is still in white
I'm running a martini server using fresh and I need to pass some command line args to my program, but can't find any support for it.
It would be great with either a command line switch for the fresh
command:
fresh -a "--my-custom-arg=123 --and-another=true"
... or an option in the config file:
args: --my-custom-arg=123 --and-another=true
Perhaps both?
Minimal case,
func main () {
log.Println ("Hello There! %Y %s", "123")
}
And you will see this in fresh,
15:24:52 app | 2016/05/16 15:24:52 Hello There! %!Y(MISSING) %!s(MISSING) 123
I start a project with go mod. When I build and run my project, I can use go build -mod=vendor cmd/main.go
and go run -mod=vendor cmd/main.go
.
But I can not use fresh, because the source of build step in fresh is cmd := exec.Command("go", "build", "-o", buildPath(), root())
.
Am I right? How can I use fresh in my project.
My project folder is :
├── cmd
│ └── main.go
├── go.mod
├── go.sum
├── internal
├── runner.conf
└── vendor
i have 2 project/service on the same directory (and subdirectory), one listen on 3000, and other one 8088
with https://github.com/codegangsta/gin
i can do this:
gin -i -b service1 # proxies 3000 for 3001
cd service2 && ./start2.sh
# where the content of start2.sh are something like this:
gin -i -b service2 -p 8088 -a 8089
is there equivalent configuration for fresh?
I wait a long time for the first time to load it. I got a lot of messages which I do not care about
From my own expirence I know that a log takes a lot of time. So, it may be a good suggestion to not display the ignored directories, but just the ones that I am interested in wathcing
What do you think?
I've been using fresh for several years and it's worked perfectly (thank you)! However, I recently encouraged co-workers to use it and their fresh installs leave the runner-build process running when fresh exits (when they kill fresh using control-c). Any ideas what's going wrong? One co-worker is running on mac and another on ubuntu. The runner.conf contains just ignored: vendor
go build
doesn't cache, it could be fine to use the cache of go install
I am trying to run this on Windows 7. It returns this:
fresh: command not found
I have a config file. I don't know any other step to run it even after reading readme file.
And i did this;
go get -u github.com/pilu/fresh
What should i do to simply run it.
i always face this issue when i run this command
"inotify_init: too many open files"
any suggestions ?
I've been playing with fresh a bit lately and i'm loving it. I'd really like to see something in the config that allows me to run my own custom commands when changes occur.
An example might be to run ctags.
I installed fresh using go get and I see it being placed at ~/go/src/github.com/pilu/fresh
.
echo $GOPATH
/home/me/go
I can build and run my project at ~/go/src/myapp
, but as for fresh I get:
me@pc:~/go/src/myapp$ fresh
fresh: command not found
How can I fix this?
Using fresh
with a small Go server on OS X. Whenever I save a file, fresh
recompiles and restarts the application twice. Is this common? How to troubleshoot this?
Other than this small issue, really enjoying the tool. Please keep it up!
The project I am trying to use Fresh with uses AngularJS for everything UI-related (no use of html/template
anywhere), and Fresh dies when it tries to descend into the directory containing all of the AngularJS stuff.
I tried to restrict which files Fresh looks at by setting valid_ext: .go
in a custom config file, however Fresh still fails like so:
$ fresh -c=fresh.conf
Loading settings from fresh.conf
12:10:09 runner | InitFolders
12:10:09 runner | mkdir ./tmp
12:10:09 runner | mkdir ./tmp: file exists
12:10:09 watcher | Watching .
12:10:09 watcher | Watching old-data
12:10:09 watcher | Watching www
12:10:09 watcher | Watching www/app
12:10:09 watcher | Watching www/app/css
12:10:09 watcher | Watching www/app/fonts
12:10:09 watcher | Watching www/app/img
12:10:09 watcher | Watching www/app/js
12:10:09 watcher | Watching www/app/lib
12:10:09 watcher | Watching www/app/lib/angular
12:10:09 watcher | Watching www/app/lib/angular/i18n
too many open files
Hi, I'm getting the following error:
go get github.com/pilu/fres
# github.com/pilu/fresh/runner
..\..\..\..\!gopath\src\github.com\pilu\fresh\runner\start.go:92: undefined: syscall.Rlimit
..\..\..\..\!gopath\src\github.com\pilu\fresh\runner\start.go:95: undefined: syscall.Setrlimit
..\..\..\..\!gopath\src\github.com\pilu\fresh\runner\start.go:95: undefined: syscall.RLIMIT_NOFILE
Any ideas as to why this is happening?
Note: !gopath is my %GOPATH%
Hey @pilu - just wondering if you're no longer supporting fresh? .. it's a great project and my team uses it everyday (my fork though, since its quite stale) .. whats up?
Cant see the console log color with fresh command
when i try to run the code below, i could not parse flags given
fresh go run main.go -env debug
thank you
I was trying to set fresh up in a project that has a structure like this:
myProject/
public/
index.html
...
src/
files.go
...
scripts/
fresh.runner.conf
I made a config that sets the root to: .domain.com/me/myProject/src
Then I change into the myProject location and run: `fresh -c scripts/fresh.runner.conf``
The watcher crashes with:
Loading settings from scripts/fresh.runner.conf
16:30:05 runner | InitFolders
16:30:05 runner | mkdir ./tmp
16:30:05 runner | mkdir ./tmp: file exists
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x43e51c]
goroutine 1 [running]:
runtime.panic(0x4fdc00, 0x659ce8)
/usr/local/go/src/pkg/runtime/panic.c:266 +0xb6
github.com/pilu/fresh/runner.func·005(0xc2100640d3, 0x2b, 0x0, 0x0, 0x7f20247ea238, ...)
/path/to/go/src/github.com/pilu/fresh/runner/watcher.go:41 +0x2c
path/filepath.Walk(0xc2100640d3, 0x2b, 0x55d160, 0x4, 0xc2100661b0)
/usr/local/go/src/pkg/path/filepath/path.go:378 +0x81
github.com/pilu/fresh/runner.watch()
/path/to/go/src/github.com/pilu/fresh/runner/watcher.go:50 +0x6b
github.com/pilu/fresh/runner.Start()
/path/to/go/src/github.com/pilu/fresh/runner/start.go:110 +0x32
main.main()
/path/to/go/src/github.com/pilu/fresh/main.go:35 +0x16c
My hope was that I could monitor both the public/ static files, along with the go source in the sub directories.
Thanks!
execute command such as swag init
and so on
I'm trying to build y app in a Vagrant box with shared folder between the VM and my local computer. However Fresh doesn't seem to rebuild when I edit files locally.
Has anyone experienced something similar?
Adding a directory to the ignored
list does not make fresh
ignore all nested directories/files.
I think there are too much debug info from fresh, it couldn't be ignore and added prefix strings to my output. It makes debug more harder.
There should be an option to mute fresh.
Is there any flags to specify the exact build parameters:
I run a mac but I want to build a linux executable.
I use this command:
GOOS=linux GOARCH=amd64 go build -o main.linux main.go
I'm wanting to use delve and fresh on a docker container to build and debug my project even when i alter some file. Anyone know how to do it?
Is there a setting for this? It looks like there isn't anything referenced in the config file.
The reason I'm asking is that I have a vendor
directory, and fresh
logs everything in there on startup, like so:
12:52:11 watcher | Watching .
12:52:11 watcher | Watching vendor
12:52:11 watcher | Watching vendor/github.com
12:52:11 watcher | Watching vendor/github.com/julienschmidt
12:52:11 watcher | Watching vendor/github.com/julienschmidt/httprouter
12:52:11 watcher | Watching vendor/github.com/kelseyhightower
12:52:11 watcher | Watching vendor/github.com/kelseyhightower/envconfig
...
There's also a bunch of what looks like debug output about receiving events, checking for file existence, etc.
It looks like you've got these logs nicely separated into different loggers already from the output, so I guess what I'm really asking for is a way to only see the output from the build
and runner
loggers.
I followed the instructions.
I used go get -> No errors.
Yet when I cd to my go programs path and type "fresh" it says: -bash: fresh: command not found
Do I need to change my PATH ENV VARIABLE to point to somewhere specific?
PS C:\Users\shxu\Dropbox\go\src\poem> go get github.com/pilu/fresh
..\github.com\pilu\fresh\runner\start.go:92: undefined: syscall.Rlimit
..\github.com\pilu\fresh\runner\start.go:95: undefined: syscall.Setrlimit
..\github.com\pilu\fresh\runner\start.go:95: undefined: syscall.RLIMIT_NOFILE
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.