Git Product home page Git Product logo

guard-go's People

Contributors

aigeruth avatar ankhers avatar ariejan avatar dmantilla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

guard-go's Issues

bundle exec guard init go throws error

I am facing issue in initializing guard-go in windows. Other plugins work fine, I were able to use guard-sass.
Details:
OS: Windows
ruby: ruby 2.4.3p205 (2017-12-14 revision 61247) [x64-mingw32]

please find the details
Gemfile

source "https://rubygems.org"

group:development do 
    gem 'guard'
    gem 'guard-go'
    gem 'win32console'
    gem 'guard-sass'
end

I have installed the gem using bundle install.

But bundle exec guard init go throws error

11:04:08 - ERROR - Could not load 'guard/go' or '~/.guard/templates/go' or find class Guard::Go
 [#]

If i manually add the plugin code to Guardfile

guard 'go', :server => 'app.go' do
  watch(%r{\.go$})
end

Then bundle exec guard give me an error like

11:10:45 - ERROR - Could not load 'guard/go' or find class Guard::Go
11:10:45 - ERROR - Error is: cannot load such file -- guard/guard
11:10:45 - ERROR - C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-go-0.0.4/lib/guard/go.rb:2:in `require'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-go-0.0.4/lib/guard/go.rb:2:in `<top (required)>'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/plugin_util.rb:105:in `require'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/plugin_util.rb:105:in `rescue in plugin_class'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/plugin_util.rb:96:in `plugin_class'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/plugin_util.rb:56:in `initialize_plugin'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/internals/plugins.rb:26:in `add'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/dsl.rb:185:in `block in guard'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/dsl.rb:182:in `each'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/dsl.rb:182:in `guard'
> [#] C:/Users/vaisr/Var23Workshop/Go/src/Prom/Guardfile:17:in `evaluate'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/dsl.rb:377:in `instance_eval'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/dsl.rb:377:in `evaluate'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/guardfile/evaluator.rb:89:in `evaluate'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard.rb:134:in `_evaluate'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard.rb:49:in `setup'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/commander.rb:32:in `start'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/cli/environments/valid.rb:16:in `start_guard'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/cli.rb:122:in `start'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/aruba_adapter.rb:32:in `execute'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/aruba_adapter.rb:19:in `execute!'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/bin/_guard-core:11:in `<main>'
11:10:45 - ERROR - Invalid Guardfile, original error is:
> [#]
> [#] Could not load class: "Go",
> [#] backtrace:
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C

https://stackoverflow.com/questions/48636200/error-could-not-load-guard-go-or-guard-templates-go-or-find-class-guard

Named arguments

Can you do named arguments with this?

Also, is this only for running long running processes like servers or can this be used to run cli go commands?

For example, on file change:

go-dynamic-binary -d option -e otheroption

go run no longer produces a.out in ps [go1.1.1]

The process kill based on finding a.out in ps (or killall a.out) doesn't seem to work after upgrading to go 1.1.1. It seems its now naming executables after the file name passed to run. We need to come up with a more clever way to find the go process.

go restful

I've been trying to use this to start/restart go-restful. I continue to get address is already bound errors when it restarts my app or I ctrl+d and restart guard-go myself.

22:48:28 - INFO - Running app.go...
22:48:28 - INFO - Started Go app, pid 14113
22:48:28 - INFO - Guard is now watching at '/Users/user/go/src/stash.rmn.com/perf/restify'
[1] guard(main)> 2014/03/20 22:48:29 [restful/swagger] listing is available at http://localhost:8080/apidocs.json
2014/03/20 22:48:29 [restful/swagger] http://localhost:8080/apidocs/ is mapped to folder ./swagger
2014/03/20 22:48:29 start listening on localhost:8080
22:48:43 - INFO - Running app.go...
22:48:43 - INFO - Started Go app, pid 14142
[1] guard(main)> 2014/03/20 22:48:45 [restful/swagger] listing is available at http://localhost:8080/apidocs.json
2014/03/20 22:48:45 [restful/swagger] http://localhost:8080/apidocs/ is mapped to folder ./swagger/
2014/03/20 22:48:45 start listening on localhost:8080
2014/03/20 22:48:45 listen tcp :9080: bind: address already in use
exit status 1

Guard init fails

Trying to run $ bundle exec guard init go, results in:

12:35:33 - ERROR - Could not load 'guard/go' or '~/.guard/templates/go' or find class Guard::Go
12:35:33 - ERROR - Error is: No such file or directory @ rb_sysopen - /Users/ryanbillingsley/.guard/templates/go

Guard: 2.12.4
Guard-go: 0.0.4
Ruby: 2.2.1p85

Issue getting go application to run with Guard

Hi,

I'm new to using Go and have a working script which doesn't run when using this Guard plugin. By that I mean: the output I get from the Go program, I would expect to see that same output again after the Go program is re-executed by Guard. But I don't I see any output from my Go program at all when running under this Guard plugin.

If I run my Go program like so: go run Concurrency/2.go then I typically see the following output:

I'm listening!
This is boring! 0
This is boring! 1
This is boring! 2
This is boring! 3
This is boring! 4
This is boring! 5
You're boring; I'm leaving.

I would expect to see that same output when the relevant file was re-executed by Guard. But I don't see any such output.

The following is the structure of my Go directory...

.
├── Concurrency
│   ├── 1.go
│   ├── 2.go
├── Gemfile
├── Gemfile.lock
├── Guardfile
└── examples
    ├── constants-example.go
    ├── hello-world.go
    ├── package-example.go
    ├── scope-example.go
    └── types-example.go

Note that I'm not developing a proper Go application; it's just a collection of miscellaneous files. This is simply because I'm playing around with different Go code and so I'm not building a proper application (e.g. nearly all of the files you see all define a main function, where as in a proper Go application there would only be one file that was the entry point to main - AFAIK).

The script I'm trying to have executed when any other files are edited is Concurrency/2.go and the contents of that file looks like the following:

package main
import (
    "fmt"
    "math/rand"
    "time"
)

func main() {
    go boring("This is boring!")

    fmt.Println("I'm listening!")
    time.Sleep(2 * time.Second)
    fmt.Println("You're boring; I'm leaving.")
}

func boring(msg string) {
    for i := 0; ; i++ {
        fmt.Println(msg, i)
        time.Sleep(time.Duration(rand.Intn(1e3)) * time.Millisecond)
    }
}

The Guardfile looks like the following:

guard "go", :server => "Concurrency/2.go" do
  watch(%r{^(.+)\.go$}) { |match| puts match }
end

The command I'm running is: bundle exec guard which outputs...

12:11:00 - INFO - Guard is using Tmux to send notifications.
12:11:00 - INFO - Guard is using TerminalTitle to send notifications.
12:11:00 - INFO - Running /Users/markmcdonnell/Box Sync/Library/Go/Concurrency/2.go...
sh: line 0: cd: /Users/markmcdonnell/Box: No such file or directory
12:11:00 - INFO - Started Go app, pid 4167
12:11:00 - INFO - Guard is now watching at '/Users/markmcdonnell/Box Sync/Library/Go'

Notice there is also a problem with the fact that I keep my files sync'ed using Box and that has a space in its directory name and so somewhere the plugin seems to be trying to cd into the directory but can't as the path isn't being escaped properly.

When I edit another file (e.g. examples/constants-example.go) then I see the following output:

[1] guard(main)> ["examples/constants-example.go", "examples/constants-example"]
12:23:08 - INFO - Running /Users/markmcdonnell/Box Sync/Library/Go/Concurrency/2.go...
sh: line 0: cd: /Users/markmcdonnell/Box: No such file or directory
12:23:08 - INFO - Started Go app, pid 4661

So it has watched the set of files correctly; it still tries to cd into a directory incorrectly though. But more importantly I would have expected to have seen the output of the Go problem?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.