[go-nuts] Re: using docker for compiling

2019-02-02 Thread Keith Brown
Thanks.

At the moment I use a Makefile (different from the above :-) ) .

I suppose I am asking because I want to integrate vim-go with the docker 
build ( docker run -v $PWD:/mnt -w /mnt bash -c "go build main.go" ) 
Was wondering if anyone has done that before. 


On Friday, February 1, 2019 at 7:30:32 PM UTC-5, Space A. wrote:
>
> You simply need 
> docker run <...>
> which will invoke smth like 
> go build
> at the end.
>
> PS: The above Makefile is garbage.
>
>
> пятница, 1 февраля 2019 г., 21:59:53 UTC+3 пользователь Bojan Delić 
> написал:
>>
>> I have Makefile that supports build in docker image, part of it looks 
>> something like this:
>>
>> NAME := 
>> PACKAGE := github.com/username/repo
>>
>>
>> .PHONY: build
>> build: clean gobuild ## Build application
>>
>> .PHONY: gobuild
>> gobuild: LDFLAGS=$(shell ./scripts/gen-ldflags.sh $(VERSION))
>> gobuild:
>>@echo "Building '$(NAME)'"
>>@env go generate -mod=vendor
>>@CGO_ENABLED=0 go build -mod=vendor --ldflags "$(LDFLAGS)" -tags netgo .
>>
>> .PHONY: clean
>> clean: ## Remove build artifacts
>>@echo "==> Cleaning build artifacts..."
>>@rm -fv coverage.txt
>>@find . -name '*.test' | xargs rm -fv
>>@rm -fv $(NAME)
>>
>> .PHONY: build-in-docker
>> build-in-docker:
>>@docker run --rm \
>>   -v $(shell pwd):/go/src/$(PACKAGE) \
>>   -w /go/src/$(PACKAGE) \
>>   -e GO111MODULE=on \
>>   golang:latest \
>>   make build
>>
>>
>> As you can see, there are some external scripts called (like 
>> gen-ldflags.sh) and docker build is just invoking "make build" inside 
>> docker container. I do not use this for CI (GitLab CI is already setup to 
>> use docker images), so that is why I use latest tag (in CI I use explicit 
>> version of Go). 
>>
>>
>> There are some leftovers from earlier times, like mounting working dir to 
>> GOPATH, which is not needed if GO111MODULE is set.
>>
>>
>> On Friday, February 1, 2019 at 4:48:01 AM UTC+1, Keith Brown wrote:
>>>
>>> does anyone use docker golang image to compile? if so,how is your setup?
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] using docker for compiling

2019-01-31 Thread Keith Brown
does anyone use docker golang image to compile? if so,how is your setup?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] slow running job

2018-11-15 Thread Keith Brown
I am running a service (web) type job.
It takes 30-40 secs for the job to start up when I do it manually. 

Is there anything in nomad which will kill the job if it doesn't start in X 
secs? 

I am having a strange issue where the job starts up sometimes and sometimes 
it fails.

If I do nomad alloc logs  

I get nothing back but sometimes I also get
Unexpected response code: 500 (failed to list entries)




-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] go modules and gocode

2018-11-11 Thread Keith Brown
got it working.

take a look at this

https://github.com/keith6014/go/wiki/vim-go-setup


On Friday, November 9, 2018 at 4:54:04 PM UTC-5, Tyler Compton wrote:
>
> My understanding is the mdempsky branch is not expected to work with Go 
> modules. This fork apparently will: https://github.com/stamblerre/gocode
>
> That said, I haven't personally had any luck with that fork either. I 
> would love to hear from someone who's had success with 
> gocode/vim-go/modules.
>
> On Fri, Nov 9, 2018 at 1:03 PM Keith Brown  > wrote:
>
>> Using vim-go
>>
>> Has anyone gotten gocode (https://github.com/mdempsky/gocode) to work 
>> with golang modules? 
>>
>> In my GOPATH directory, i see
>>
>> gopath
>>   pkg
>> mod
>>  cache
>>download
>>  github.com
>>
>> But for whatever reason, its not autocompletting the modules.
>>
>> Is there anything else I should be doing? In addion, is there a better 
>> solution for vim users? 
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] go modules and gocode

2018-11-09 Thread Keith Brown
Using vim-go

Has anyone gotten gocode (https://github.com/mdempsky/gocode) to work with 
golang modules? 

In my GOPATH directory, i see

gopath
  pkg
mod
 cache
   download
 github.com

But for whatever reason, its not autocompletting the modules.

Is there anything else I should be doing? In addion, is there a better 
solution for vim users? 


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] using ginkgo

2018-04-25 Thread Keith Brown
thank for the response John.

My intention is to run integration test where I specify my test in english 
(acceptance test driven tests). I dont mind generating the binary but I 
would like to use the binary to test components such as. 1) if the web 
server is alive. 2) if a certain url gives me a 202 for a POST/GET etc...

On Friday, April 20, 2018 at 8:26:24 AM UTC-4, John Shahid wrote:
>
>
> Keith Brown <keit...@gmail.com > writes: 
>
> > I would like to have a tool for testing infrastructure components. I 
> > stumbled across Ginkgo. Does anyone use it? 
>
> Yes, it is being used by multiple CloudFoundry projects [1] 
>
> > Does it need a go compiler for tests? 
>
> Yes. 
>
> > My intention is to write simple tests, "Is server up?". "Does the file 
> > contain abc". But I don't want to have the go compiler installed to 
> > run the library. Does such a tool exist? 
>
> I'm not sure what you mean by library, but you can pre-compile a test 
> binary by running `go test -c  -o a.out'. You loose certain 
> features by doing so. For example, you won't be able to run the tests in 
> parallel. 
>
> Hope I answered your question. If not, may be adding more context on 
> what you're trying to do would help. 
>
> cheers, 
>
> -js 
>
> [1]: https://github.com/cloudfoundry?utf8=%E2%9C%93===go 
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] using ginkgo

2018-04-19 Thread Keith Brown
I would like to have a tool for testing infrastructure components. I 
stumbled across Ginkgo. Does anyone use it?  Does it need a go compiler for 
tests? My intention is to write simple tests, "Is server up?". "Does the 
file contain abc". But I don't want to have the go compiler installed to 
run the library. Does such a tool exist?


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: code structure question

2018-04-18 Thread Keith Brown
I like the idea of putting each command in an ishell.Cmd.

Yeah, I wasn't sure about the struct. Basically, I wanted an easy way to 
map my code

so, I was thinking a yaml file (I suppose I can create a struct from it).

- clear
- greet 
  - user
  - (no user) #if no user is specified then greet all users
- list 
  - tables
  - acls
- red
- blue 
- exit

I guess I was sort of looking for a GRPC (protoful file) model where I 
specify my specs in a file and go by it -- single source of truth.


On Wednesday, April 18, 2018 at 9:09:08 AM UTC-4, matthe...@gmail.com wrote:
>
> Consider putting each ishell.Cmd in a separate file. Otherwise you can put 
> them in a slice var so you don’t have to AddCmd each one explicitly.
>
> I’m not sure what defining a struct accomplishes, can you provide more 
> detail?
>
> Matt
>
> On Tuesday, April 17, 2018 at 8:25:17 PM UTC-5, Keith Brown wrote:
>>
>> I am writing an interactive CLI tool which looks like this, using 
>> abisoft/ishell
>>
>> ./tool
>> >>> help
>>
>> Sample Interactive Shell
>> >>> help
>>
>> Commands:
>>   clear  clear the screen
>>   greet  greet user
>>   exit   exit the program
>>   help   display help
>>
>> >>> greet Someone Somewhere
>> Hello Someone Somewhere
>> >>> exit
>>
>> My tool will have many subcommands. 
>>
>> So, greet  < subcommand> and I was wondering what would be a 
>> good way to structure the program. I was thinking of putting everything in 
>> one large struct and have nested structs for commands similar to JSON 
>> encoded file.
>>
>> any thoughts?
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] code structure question

2018-04-17 Thread Keith Brown
I am writing an interactive CLI tool which looks like this, using 
abisoft/ishell

./tool
>>> help

Sample Interactive Shell
>>> help

Commands:
  clear  clear the screen
  greet  greet user
  exit   exit the program
  help   display help

>>> greet Someone Somewhere
Hello Someone Somewhere
>>> exit

My tool will have many subcommands. 

So, greet  < subcommand> and I was wondering what would be a good 
way to structure the program. I was thinking of putting everything in one large 
struct and have nested structs for commands similar to JSON encoded file.

any thoughts?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] projects using net/http

2018-01-26 Thread Keith Brown
Are there any open source projects which use net/http exclusively? I am 
building something and would like to follow the best practices of a 
project. I need to visualize a lot of json data in a form of tables/charts. 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] study go package

2018-01-19 Thread Keith Brown
I want to pick up good practices when developing my go code. Is there a 
package which I can study and comprehend for newbies? I mainly use 
effective go but would like to see more examples of good software/code 
design layout. 

BTW, in Python I always followed twisted as my examples for testing, code 
layout,etc...


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Having a Model Package

2018-01-17 Thread Keith Brown
is there a page such as "https://github.com/yksz/go-design-patterns; I can 
refer to for golang design-patterns? I wish there were some official ones, 
which can help language newbies and give them confidence that what they are 
doing is the "right way". I understand it depends on the problem but would 
be great if something was there.


On Saturday, December 16, 2017 at 2:52:14 AM UTC-5, dc0d wrote:
>
> I've been reading the other day: "having a model package, is considered a 
> code smell, in Go".
>
> 1 - Why?
> 2 - If so, what approach should be chosen? 
> 3 - And how? (In Go code, Go features to employ, Patterns (small/big 
> projects), etc)
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] ListenAndServ and channels

2018-01-04 Thread Keith Brown
I am trying to Serve a webpage while running a ticker in the background. I 
am trying to generate a random number, genRandom() , periodically and 
publish it on a channel so generic() can see the results. I have something 
like this https://play.golang.org/p/6d1xmqpUYY7 but I don't know how to get 
channel results to generic()? Do I need to make my mc channel a global? 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] acceptance test-driven development

2017-12-17 Thread Keith Brown
Are there any tools written in go that are similar 
to http://robotframework.org/ ? I like Robotframe work because its simple 
to write test but the downside is I either need python or jre installed to 
run the tests. This is a burdon. 

Ideally, it would be great if there was a single binary I can run my tests 
against and I think go would be a great candidate for it. If anyone wants 
to work on something like this let me know I can contribute.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] python remote objects

2017-12-13 Thread Keith Brown
is it possible to analyze python remote objects in go? we have several 
people using it and i would like to view the calls using go.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] swagger

2017-12-03 Thread Keith Brown
I am trying to use golang and swagger but I am confused on what package I 
should use: 
There is: https://github.com/go-swagger/go-swagger or 
https://github.com/yvasiyarov/swagger

Does anyone use Swagger with go and any tips would be much appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: goroutines with better exceptions

2017-11-05 Thread Keith Brown
sure, in line 16.

So, don't continue means I can do this?

ch <- Result{500}
return




On Saturday, November 4, 2017 at 5:26:37 PM UTC-4, Tamás Gulácsi wrote:
>
> If err!=nil, response is nil, too - so don't continue!

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] goroutines with better exceptions

2017-11-04 Thread Keith Brown
Hi All

Using goroutines to do some load testing on a webserver. 

I have some code like this, https://play.golang.org/p/e2_ecJN0l4

It works but when the server get overloaded it returns an RSP. I would like 
to gracefully catch that and put an appropriate status code such as 500.
The exact error message I get is, "panic: runtime error: invalud memory 
address or nil pointer dereference" 
It shows it around the defer httpResp.Body.Close()


Can you suggest a better way of doing this?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Announcing: Skylark in Go

2017-11-04 Thread Keith Brown
Cool tool.

Are there any native golang tools simar to this which work on 
Windows/Linux/OSX? 

On Thursday, November 2, 2017 at 9:42:27 PM UTC-4, Ben Hoyt wrote:
>
> That looks really neat. I will dive into the code!
>
> I'm very curious how the performance of Skylark in Go compares to Skylark 
> in Java (and CPython 3.6 for that matter) -- any benchmarks on that?
>
> -Ben
>
>
>
> On Monday, October 2, 2017 at 12:39:43 PM UTC-4, Alan Donovan wrote:
>>
>> I'm pleased to announce the launch of Skylark in Go: an interpreter for 
>> Skylark, implemented in Go.
>>
>> github.com/google/skylark
>>
>> Skylark is a dialect of Python intended for use as a configuration 
>> language. Like Python, it is an untyped dynamic language with high-level 
>> data types, first-class functions with lexical scope, and garbage 
>> collection. Unlike CPython, independent Skylark threads execute in 
>> parallel, so Skylark workloads scale well on parallel machines. Skylark is 
>> a small and simple language with a familiar and highly readable syntax. You 
>> can use it as an expressive notation for structured data, defining 
>> functions to eliminate repetition, or you can use it to add scripting 
>> capabilities to an existing application.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] http server request queue

2017-10-28 Thread Keith Brown
Here is a scenario: a high traffic site which executes costly operations 
(database / filesystem / compute heavy operations). The web server is 
running standard go/http/server.

I would like to handle at most 100 requests and the remainder to queue -- 
all while the client (curl) is waiting. Are there tools to throttle the web 
server? And is there a way to view the queue of work? 

  

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] studying golang code

2017-08-15 Thread Keith Brown
Coming from Python, I was told to use study Twisted Matrix code 7 years. I 
haven't regretted it.  Take a look at it 
yourself, http://twistedmatrix.com/documents/16.1.0/core/howto/trial.html . 

Now, as I learn golang, are there any worth while projects I can use as 
reference for writing high quality go code? I am not necessary looking for 
code standards but more of code setup and quality so I can practice those 
principles.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] LinkedList implementation

2017-05-13 Thread Keith Brown
forgot about that. thanks, I will study this.
thinking of skipping linked list and going ahead to graphs and trees

On Sat, May 13, 2017 at 8:52 AM, andrey mirtchovski
<mirtchov...@gmail.com> wrote:
> Perhaps looking at the history of the implementation will shed some light:
>
> https://github.com/golang/go/commit/01389b966ed81fad6e5fac3e98fe46e162645659
>
> On Sat, May 13, 2017 at 6:28 AM, Keith Brown <keith6...@gmail.com> wrote:
>> I am learning basic data structures and I chose golang  since it  provide C
>> like pointers. While looking at list.go I noticed this in the Element struct
>>
>>
>> type Element {
>> next, prev *Element //makes sense. Doubly linked list
>> list *List //Why! I don't understand why there is a pointer to List
>> Value interface{} //makes sense. Data interface
>> }
>>
>> Source: https://github.com/golang/go/blob/master/src/container/list/list.go
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to golang-nuts+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: NewTicker function example

2017-02-23 Thread Keith Brown
Thank You all for the great examples!

I added a select {} at the end so the program will run forever. I am trying 
to have it as a deamon.



On Thursday, February 23, 2017 at 6:37:12 AM UTC-5, Nathan Kerr wrote:
>
> NewTicker function example
>
> The task of running functions on a periodic basis can be split into two 
> parts: timing and execution.
>
> A ticker solves the timing problem by providing a channel that get new 
> input every period. Keeping the timing separate mitigates the impact of 
> execution on the timing period (e.g., it won’t be execution time + sleep 
> time)
>
> Execution can be solved by ranging over the ticker channel. The contents 
> of the loop will be run for each input received from the ticker channel. If 
> the loop executes in less than one period, the loop will execute every 
> period.
>
> Since tickers use channels, the execution loop can be run anywhere, though 
> they are frequently used in goroutines because the program is also doing 
> something else.
>
> I would simplify Rodolfo’s examples to:
>
> package main
>
> import (
> "fmt"
> "time"
> )
>
> func square(x int) int {
> return x * x
> }
>
> func cube(x int) int {
> return x * x * x
> }
>
> func main() {
> ticker := time.NewTicker(5 * time.Second)
>
> for range ticker.C {
> fmt.Println(square(10))
> fmt.Println(cube(10))
> }
> }
>
> This will run square and cube every 5 seconds while the program is 
> executing.
>
> On Thursday, February 23, 2017 at 2:39:12 AM UTC+1, Keith Brown wrote:
>>
>> Oddly, I can't find a single example on the world wide web for what I am 
>> trying to do.
>>
>> I have 2 functions which I want to run on a periodic basis. The functions 
>> are square and cube. 
>> Here is my code so far. https://play.golang.org/p/akMxcg2Sra
>> But, I am not sure how to schedule these functions.  I looked here, 
>> https://gobyexample.com/tickers, but really isn't that helpful or 
>> intuitive. 
>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] NewTicker function example

2017-02-22 Thread Keith Brown
Oddly, I can't find a single example on the world wide web for what I am 
trying to do.

I have 2 functions which I want to run on a periodic basis. The functions 
are square and cube. 
Here is my code so far. https://play.golang.org/p/akMxcg2Sra
But, I am not sure how to schedule these functions.  I looked 
here, https://gobyexample.com/tickers, but really isn't that helpful or 
intuitive. 



-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.