[go-nuts] Gophercon 2019 videos?

2019-07-26 Thread gary . willoughby
With the recent Gophercon being held I wonder if any videos have been posted of the talks? I'm especially interested in the move to Go 2 and the plans for generics. Thanks. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

[go-nuts] Re: go modules and vendor: redundant features?

2018-11-22 Thread gary . willoughby
Vendor must be kept for when dependencies are no longer available online. On Saturday, 17 November 2018 04:33:55 UTC, Henry wrote: > > Hi, > > It seems to me that go modules and vendor attempt to solve the same > problem. I wonder whether we should just choose one and scrap the other, or >

[go-nuts] Re: non-standard json

2018-11-01 Thread gary . willoughby
If the file is consistent parse the Json part out of each line and just unmarshal it. On Thursday, 1 November 2018 16:14:17 UTC, Alex Dvoretskiy wrote: > > Is there is a way to read a file line by line and extract JSON data from > it? > > > Example: > > file: > ` > value1: {"field1": "123,

Re: [go-nuts] Regarding contracts

2018-10-24 Thread gary . willoughby
Maybe it's worth adding to: https://github.com/golang/go/wiki/Go2GenericsFeedback On Tuesday, 23 October 2018 17:37:40 UTC+1, Burak Serdar wrote: > > I typed this up in a more organized way, and it turned out to be an > alternative declaration for contracts without touching the generics >

Re: [go-nuts] How would Go 2 code using generics actually look like?

2018-10-23 Thread gary . willoughby
In that example, how would you call the `New` function? On Monday, 22 October 2018 10:10:51 UTC+1, Sebastien Binet wrote: > > Hi Volker, > > On Mon, Oct 22, 2018 at 10:57 AM Volker Dobler > wrote: > >> The Go 2 draft generics draft has been discussed a lot, >> especially contracts have drawn a

[go-nuts] Having trouble installing golint

2018-10-17 Thread gary . willoughby
I'm having trouble installing golint. Any idea what the problem could be? $ go get -u -v github.com/golang/lint/golint github.com/golang/lint (download) package github.com/golang/lint/golint: code in directory /home/gary/Code/go/ src/github.com/golang/lint/golint expects import

[go-nuts] Re: A concrete proposal re: using interfaces instead of contracts in Go 2 generics.

2018-10-11 Thread gary . willoughby
Add it to this: https://github.com/golang/go/wiki/Go2GenericsFeedback On Wednesday, 10 October 2018 22:14:35 UTC+1, Ian Denhardt wrote: > > I've seen a lot of folks expressing the sentiment "we should just use > interfaces instead of this new contract thing." Most of the discussion > I've seen

Re: [go-nuts] Where are the dependencies saved when we use go mod

2018-10-09 Thread gary . willoughby
You can also use the handy command `go mod download -json` to view information about the dependencies and where they are on disk for a module. On Monday, 8 October 2018 22:29:46 UTC+1, ppras...@splunk.com wrote: > > Got it, Thanks Wagner. > I did not set GOPATH since I was using GO111MODULE=on.

[go-nuts] Re: When using 'go mod vendor' why are there lots of files missing?

2018-09-24 Thread gary . willoughby
I think it's worth raising an issue for this. Vendoring should copy the whole repo. On Monday, 24 September 2018 07:43:24 UTC+1, Justin Israel wrote: > > > > On Tuesday, September 18, 2018 at 8:58:01 AM UTC+12, Frits van Bommel > wrote: >> >> According to the help text that's the intended

[go-nuts] Re: Examples testing with two newline, but only one newline

2018-08-13 Thread gary . willoughby
Your program doesn't work. On Saturday, 11 August 2018 09:10:04 UTC+1, 子風 wrote: > > Hi > > https://play.golang.org/p/AIB-yJaExVu > > When I want to use examples to test my code, I find something odd. > Example1 could pass, but Example2 failed > > --- FAIL: Example2 (0.00s) >> got: >> hello >> .

[go-nuts] Re: How to signal(sigint) blocking goroutine

2018-08-09 Thread gary . willoughby
See this blog post for more interesting ways to handle goroutine communication and synchronization: http://nomad.uk.net/articles/interesting-ways-of-using-go-channels.html On Wednesday, 8 August 2018 04:59:48 UTC+1, natea...@gmail.com wrote: > > https://play.golang.org/p/d5n9bYmya3r > > I'm new

[go-nuts] Re: How to signal(sigint) blocking goroutine

2018-08-09 Thread gary . willoughby
Just re-organise the code a bit, try this: https://play.golang.org/p/GMpfZlCNP9G On Wednesday, 8 August 2018 04:59:48 UTC+1, natea...@gmail.com wrote: > > https://play.golang.org/p/d5n9bYmya3r > > I'm new to the go language and trying to figure out how to sigint a > blocking goroutine. in the

[go-nuts] Re: Error getting FormValue in MultipartForm http request in Go 1.10

2018-05-18 Thread gary . willoughby
Maybe file an issue here?: https://github.com/golang/go/issues On Friday, 18 May 2018 13:55:00 UTC+1, Sergey Mosalov wrote: > > Hi! > In version 1.9, I had no problem getting the FormValue in http request. > After upgrading to version Go 1.10 of FormValue is empty. Did I find the > error? in

[go-nuts] Re: It was removed some packages from go.googlesource.com

2018-04-24 Thread gary . willoughby
OMG I didn't realize that repo had gone. I need to update some of my projects. Christ sake!!! On Tuesday, 24 April 2018 16:42:33 UTC+1, thec...@netflix.com wrote: > > Hey Gary, > > This isn't a leftpad moment. Your code can still be compiled, and there's > a not too invasive workaround: > > -

[go-nuts] Re: It was removed some packages from go.googlesource.com

2018-04-24 Thread gary . willoughby
This is Go's leftPad moment. Dependency management is a complete joke in Go! https://www.theregister.co.uk/2016/03/23/npm_left_pad_chaos/ On Monday, 23 April 2018 14:58:55 UTC+1, takanao ENDOH wrote: > > Hi, guys. > > Could not `go get golang.org/x/lint/golint` >

Re: [go-nuts] Is it possible to unmarshall Json by selecting the struct from a field in the Json?

2018-03-29 Thread gary . willoughby
Thanks for the all the responses but I was after a more dynamic solution where you don't need to 'register' the types or select them using a switch but that it just works. For example, to support new types (like the PHP code) I was hoping you could just add the structs and no more changes to

[go-nuts] Re: Is it possible to unmarshall Json by selecting the struct from a field in the Json?

2018-03-28 Thread gary . willoughby
Thanks. I read that blog post earlier and presents two different ways of handling this. Each maintains a list of switch cases and constants respectively so still not entirely dynamic. I'll probably just go with a switch then. On Wednesday, 28 March 2018 13:25:47 UTC+1, Andrei Tudor Călin

[go-nuts] Is it possible to unmarshall Json by selecting the struct from a field in the Json?

2018-03-28 Thread gary . willoughby
Is it possible to unmarshall Json by selecting the struct from a field in the Json? I'm porting some PHP code to Go and this is something I may have to approach differently. Here is the Json: [ { "class": "Domain\\Model\\Message", "skus": [ "FOO1" ],

[go-nuts] Re: Is there any ways to kill goroutine immediately ?

2018-01-11 Thread gary . willoughby
A `return` should kill it. On Thursday, 11 January 2018 15:50:24 UTC, Iman Tumorang wrote: > > I'm using goroutine with 2 concurrent jobs. > > And I've using context with both of the goroutine. > > I use > context.WithTimeout > > > func (u *feedUsecase) fetchDataWithContext(ctx

[go-nuts] Re: Go Code Debugging

2017-11-22 Thread gary . willoughby
I think it's a nightmare to set Eclipse up to support Go. Here's a 20 minute tutorial: https://www.youtube.com/watch?v=v6Wn5gUSEwM If you fancy swapping editor, try Visual Studio Code. It's Go support is second to none (just install the Go plugin and you're done) and has excellent debugging

[go-nuts] Re: Perfomance - sha256 Encoding to Hex

2017-10-17 Thread gary . willoughby
There are syntax errors in your code. On Tuesday, 17 October 2017 09:13:41 UTC+1, Christian LeMoussel wrote: > > I need to calculate 10 millions of sha256 checksums, > > Actually I do this : > > var bl int > var pnb = make([]byte, 10) > var hash = [32]byte > var sha256Hash string > var steps =

[go-nuts] Re: Building golang libraries

2017-09-29 Thread gary . willoughby
You could try plugins: https://golang.org/pkg/plugin/ On Friday, 29 September 2017 05:21:54 UTC+1, Abhijit Desai wrote: > > Want to create libraries ( static or dynamic ) so that that I don't want > to compile every time when I build my executable > > "github.com/everjit/Ion" <--- should not

[go-nuts] Re: Generics and readability

2017-08-24 Thread gary . willoughby
Using D syntax: func (r MyType) foo(A, B)(x A, y B) (z B, err error) { ... } result, _ := MyType.foo!(int, int)(10, 20) Also, there's no reason why A and B can't be inferred: result, _ := MyType.foo(10, 20) It looks alright to me and very useful! On Thursday, 24

[go-nuts] Re: idea: generic methods on slices with some generic type support []string.Map(string) []string => [].Map() []

2017-06-02 Thread gary . willoughby
Right, now show me the contents of the *average wage by country *function! It's not going to be one line or as readable is it?!?! On Friday, 2 June 2017 14:26:47 UTC+1, Egon wrote: > > On Friday, 2 June 2017 15:59:41 UTC+3, gary.wi...@victoriaplumb.com wrote: >> >> Generics enable more than just

[go-nuts] Re: Weird performance with exp/shiny

2017-04-28 Thread gary . willoughby
I'm just guessing but I don't think the emulated version is faster, just that it is not being throttled. Usually, when creating games or demos there is a throttle in the code to stop the main loop from executing as fast as it can. It looks like this is being respected on Mac but not in the

[go-nuts] Re: Turning unicode code string to rune

2017-04-24 Thread gary . willoughby
See: https://golang.org/pkg/unicode/utf8/#DecodeRuneInString On Saturday, 22 April 2017 19:51:09 UTC+1, Tong Sun wrote: > > Hi, > > Given a unicode code string, be it "4e16", or "0x4e16", or "u4e16", how to > turn it into a single char rune? > > You can finish the code at

Re: [go-nuts] Algorithm Club

2017-03-28 Thread gary . willoughby
Parametric polymorphism is enabled by generics. On Friday, 24 March 2017 19:16:24 UTC, Rob 'Commander' Pike wrote: > > Algorithms are not helped by generic types as much as by polymorphism, a > related but distinct subject. > > -rob > > -- You received this message because you are subscribed

[go-nuts] Re: casting slice of rune to string picks up extra characters for some inputs

2017-03-03 Thread gary . willoughby
Go strings are UTF-8 encoded as others have mentioned. This means that each human readable character in the string is really a cluster of one or more runes. Some characters are made up of one rune, some are made up of many. Some runes combine with others to create different characters. Also,

Re: [go-nuts] Problems drawing on frames of an animated gif

2017-02-06 Thread gary . willoughby
Thanks! On Sunday, 5 February 2017 01:25:21 UTC, Nigel Tao wrote: > > On Mon, Jan 23, 2017 at 6:03 AM, kalekold via golang-nuts > wrote: > > Hmm.. the source gif I'm using must be compressed. Doesn't Go handle > > compressed gifs in the same way? When you say 'I

[go-nuts] Re: How has your company adopted Go ?

2016-12-19 Thread gary . willoughby
It should always be 'use the best tool for the job'. If Go seems like a good fit for a task, use it. We've used Go for creating web services accessed via restful API's and it works great. I've personally used Go to create command line utilities to help with development. We've also used it to

[go-nuts] Re: printf in color

2016-11-07 Thread gary . willoughby
https://godoc.org/?q=terminal+color On Friday, 1 February 2013 23:02:04 UTC, Constantine Vassilev wrote: > > I am printing a lot lines in command line during testing. > Visualizing using a color would be great. > > Are there a way to send color related commands to the terminal using* > printf*?

[go-nuts] Re: Ignoring UTF-8 BOM when decoding JSON

2016-09-23 Thread gary . willoughby
Yeah, the Json decoder should handle it. Maybe post a bug report? https://github.com/golang/go/issues On Friday, 23 September 2016 15:21:13 UTC+1, Mark Richman wrote: > > This works great, thanks! https://github.com/spkg/bom > > Agreed, JSON should not have BOM, however there is still software

[go-nuts] Re: Ignoring UTF-8 BOM when decoding JSON

2016-09-23 Thread gary . willoughby
This looks like a compounded error. First, Json should never have a BOM encoded within it. Second, it seems like the Go Json decoder doesn't account for the BOM if it is mistakenly encoded. Both are mentioned in the Json RFC: https://tools.ietf.org/html/rfc7159#section-8.1 On Friday, 23

[go-nuts] Re: Static race detector?

2016-09-13 Thread gary . willoughby
You might be interested in this: Golang UK Conference 2016 - Nicholas Ng - Static Deadlock Detection for Go: https://www.youtube.com/watch?v=NOQdkbp-950 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Re: Request to backport OSX Sierra fix in 1.6.4

2016-09-09 Thread gary . willoughby
Purely out of interest, why not upgrade to v1.7.1? -- 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,

[go-nuts] Small complete examples which show the power of Go?

2016-08-10 Thread gary . willoughby
Hi, I'm giving a talk at work introducing Go and I'm looking for small examples to show Go's potential. For example, the following program demonstrates a bare-bones webserver in 13 lines: import ( "fmt" "net/http" ) func home(w http.ResponseWriter, r *http.Request) {