Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple build problem on git branches #40

Open
kabessao opened this issue Oct 13, 2021 · 7 comments
Open

Multiple build problem on git branches #40

kabessao opened this issue Oct 13, 2021 · 7 comments
Labels

Comments

@kabessao
Copy link

The project I'm working on has many branches that at some point are going to be merged to master, and whenever I switch branches with the application running it starts building for each modified file.

Ex.: if I change to a branch that has 100 files different from master, the application will build 100 times.

It would be nice if the application could wait, like, 1 second for files to change to build.

@silenceper silenceper added the bug label Oct 14, 2021
@silenceper
Copy link
Owner

Thanks for the feedback,I will confirm this issue later.

@silenceper
Copy link
Owner

@kabessao Are you using the latest version?

A one-second delay has been processed in the project,Is it that the delay is not enough.

gowatch/gowatch.go

Lines 58 to 66 in f7b7964

scheduleTime = time.Now().Add(1 * time.Second)
for {
time.Sleep(time.Until(scheduleTime))
if time.Now().After(scheduleTime) {
break
}
}
Autobuild(files)

gowatch/gowatch.go

Lines 110 to 118 in f7b7964

func Autobuild(files []string) {
if building {
log.Infof("still in building...\n")
return
}
building = true
defer func() {
building = false
}()

@kabessao
Copy link
Author

kabessao commented Oct 15, 2021

I belive I am, I'm using this command to install gowatch:

go get github.com/silenceper/gowatch

and inside the docker it says 1.5 on gowatch -v

and just stashing files and applying the stash later on the repo makes it build multiple times. There were 5 go files and it built 5 times one after the other.

here is a print of the log (had to redact some parts to prevent me getting into problems) :
image

@kabessao
Copy link
Author

I've just cross checked the lines that the log shows with your code on master and indeed it does not match, and checking the code inside the docker image confirms it.

That means this command is not getting the latest version:

go get github.com/silenceper/gowatch

@silenceper
Copy link
Owner

try this:

go get -u github.com/silenceper/gowatch

@kabessao
Copy link
Author

kabessao commented Oct 18, 2021

Same result, it gave me the older version.

I don't know if this helps since I'm new to golang, but this is the docker image we're using golang:1.16-alphine3.13

@silenceper
Copy link
Owner

Maybe you can also try to download https://github.com/silenceper/gowatch/releases/tag/v1.5.1 from here, and install the binary files directly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants