[go-nuts] Re: On Accepting Interfaces and Structs

2018-04-23 Thread Kaveh Shahbazian
@Jake @Bryan Thanks! Current solution I use: A package that holds the shared data type State: package state type State struct { Latitude float64 Longitude float64 Mark string Name string // ... } Three packages with different implementations and algorithms:

Re: [go-nuts] best practices for gccgo and external packages

2018-04-23 Thread Philip Brown
On Mon, Apr 23, 2018 at 9:23 PM, Ian Lance Taylor wrote: > > > There is no -buildmode=archive. Using -buildmode=c-archive should > work if that is what you want to do. > ORLLY? :-} $ go help buildmode The 'go build' and 'go install' commands take a -buildmode argument which

[go-nuts] Re: go lang best practices and git repo structure for newbies

2018-04-23 Thread vtejaswini1
Thank you Matt, I will start reading as you mentioned. BR, Teja On Monday, April 23, 2018 at 8:36:00 PM UTC+2, matthe...@gmail.com wrote: > > Hi Teja, > > I found Effective Go to be generally helpful: > https://golang.org/doc/effective_go.html > > Here’s my best example:

Re: [go-nuts] Allow name : type declarations?

2018-04-23 Thread Ian Lance Taylor
On Sat, Apr 21, 2018 at 3:50 PM, Hugh Fisher wrote: > > I'm a new Go programmer (learning in my spare time) and decided to share my > initial fumbles and what? why? moments while they're still fresh. > > First suggestion: allow a colon to be inserted between the name(s) and

[go-nuts] schollz/peerdiscovery - Pure-Go library for cross-platform local peer discovery using UDP broadcast

2018-04-23 Thread zack . scholl
After a few hours of mild hair pulling with trying to get the pkg/net ReadFromUDP to work between Windows and Linux, I eventually just went with golang.org/x/net/ipv4 to write this little library that can be used for local

[go-nuts] Re: Problem using ReadFromUDP on Windows to discover local peers

2018-04-23 Thread zack . scholl
I got it working! Got it working with golang.org/x/net/ipv4, for some reason the pkg/net ReadFromUDP just didn't work. On Monday, April 23, 2018 at 12:07:07 AM UTC-7, zack@gmail.com wrote: > > I wrote a library (schollz/peerdiscovery > ) for

Re: [go-nuts] best practices for gccgo and external packages

2018-04-23 Thread Ian Lance Taylor
On Mon, Apr 23, 2018 at 6:40 PM, Philip Brown wrote: > > the docs at > https://golang.org/doc/install/gccgo > seem to mention how to use packages for your own code, but dont mention how > to use third party packages. > > In other words, in situations where you would normally do

Re: [go-nuts] [ANN] oksvg and rasterx; SVG 2.0 path compliant renderer and rasterizer

2018-04-23 Thread Dan Kortschak
The freetype license looks it's a BSD derivative. That license would be more consistent with the static linking used by gc, so since you can choose either the freetype license or the GPL 2+, if it's not against your ideals, the FTL is probably the better choice. Note that because oksvg imports

[go-nuts] best practices for gccgo and external packages

2018-04-23 Thread Philip Brown
the docs at https://golang.org/doc/install/gccgo seem to mention how to use packages for your own code, but dont mention how to use third party packages. In other words, in situations where you would normally do go get github.org/blah/somepackage What should you do for gccgo, once you have

Re: [go-nuts] [ANN] oksvg and rasterx; SVG 2.0 path compliant renderer and rasterizer

2018-04-23 Thread Nigel Tao
Nice! On Mon, Apr 23, 2018 at 3:41 AM, Steven Wiley wrote: > I refactored and enhanced the raster package from the golang translation > of freetype, > It'd be a bunch of work, but you might consider basing off of

[go-nuts] Re: On Accepting Interfaces and Structs

2018-04-23 Thread 'Bryan Mills' via golang-nuts
I agree with Jake: a more complete example would be helpful. In my experience, this sort of issue is often a symptom of awkward package boundaries. If you can find a more natural package boundary, you may be able to sidestep the problem. (There are certainly some cases where the lack of

Re: [go-nuts] Type func binding and interfaces

2018-04-23 Thread Jan Mercl
On Mon, Apr 23, 2018 at 8:58 PM Louki Sumirniy < louki.sumirniy.stal...@gmail.com> wrote: > The type function bindings are not the problem, the problem is the fact that despite in every other way the signatures match, they will not be found by the compiler to bind to the type, and thus the need

Re: [go-nuts] Type func binding and interfaces

2018-04-23 Thread Louki Sumirniy
The type function bindings are not the problem, the problem is the fact that despite in every other way the signatures match, they will not be found by the compiler to bind to the type, and thus the need to wrap the invocations. I maybe should explain that I have had some experience

[go-nuts] Re: go lang best practices and git repo structure for newbies

2018-04-23 Thread matthewjuran
Hi Teja, I found Effective Go to be generally helpful: https://golang.org/doc/effective_go.html Here’s my best example: https://github.com/pciet/wichess My golang-nuts code review points: - don’t overuse interface (consider closures and function types/fields) - don’t overuse packages, make

[go-nuts] Re: Flutter and golang

2018-04-23 Thread Ged Wed
It's because your compiling to the wrong ISA. If it's an emulator then you need to gomobile bind to x86. -- 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

[go-nuts] Re: Flutter and golang

2018-04-23 Thread Ged Wed
I used to build only web based up. But you hit so many corner cases. With flutter you get pixel perfect control as deep as you need. To me you get much higher quality UI from flutter. And you don't have a untyped web runtime designed 20 years ago to deal with. My harsh 2 cents I admit... But

[go-nuts] go lang best practices and git repo structure for newbies

2018-04-23 Thread vtejaswini1
Hello, I was quite new to go lang. It would be good if anyone can help with best practices and practical git repo structure example for getting inspiration to kick start. Thanks, Teja -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] Type func binding and interfaces

2018-04-23 Thread roger peppe
On 22 April 2018 at 23:20, Louki Sumirniy wrote: > I essentially am trying to find an effective method in Go, preferably not > too wordy, that lets me create an abstract data type, a struct, and a set of > functions that bind to a different data type, and that I

[go-nuts] Re: On Accepting Interfaces and Structs

2018-04-23 Thread jake6502
My gut feeling is that there is an elegant way to achieve what you want. Unfortunately, I am having trouble following the code you are describing, and more importantly, what you are actually trying to accomplish. Perhaps it is my failing. If you would post a more complete example, showing the

[go-nuts] Re: Type func binding and interfaces

2018-04-23 Thread matthewjuran
Is the need for a memory efficient implementation backed by a performance profile? Matt On Monday, April 23, 2018 at 10:26:41 AM UTC-5, Louki Sumirniy wrote: > > First issue is that BAST does not use references. This is so that searches > proceed linearly through memory. Instead it uses a flat

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

2018-04-23 Thread Tamás Gulácsi
vgo is missing, too. -- 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

[go-nuts] Re: Type func binding and interfaces

2018-04-23 Thread Louki Sumirniy
First issue is that BAST does not use references. This is so that searches proceed linearly through memory. Instead it uses a flat array that it cuts into sequentially doubling sized rows, representing the slots that a binary tree has. Secondly, you just complicated my design even further with

Re: [go-nuts] liteide x33.3 released

2018-04-23 Thread Steven Wiley
Thank you! FYI, here is a working link for the first release downloads https://github.com/visualfc/liteide/releases/tag/x33.3 On Sunday, April 22, 2018 at 11:28:18 PM UTC-7, visualfc wrote: > > Hi all. > LiteIDE x33.3 released! > This version support import line jump to package source file,

[go-nuts] Re: vgo get fatal error: 'stdlib.h' file not found

2018-04-23 Thread nvcnvn
Ah, never mind... sorry for the noise! This is seem an issue of my OS. (After install glibc-devel I got a different error message) On Monday, April 23, 2018 at 9:29:12 PM UTC+7, nvcnvn wrote: > > Do I need to install any C related thing for this vgo tool? Why the normal > Go tool work normal

[go-nuts] vgo get fatal error: 'stdlib.h' file not found

2018-04-23 Thread nvcnvn
Do I need to install any C related thing for this vgo tool? Why the normal Go tool work normal (I'm able to run go get for the lib/pq package) > $ go version > go version go1.10.1 linux/amd64 > $ vgo version > go version go1.10.1 linux/amd64 vgo:2018-02-20.1 > $ vgo get github.com/lib/pq > #

[go-nuts] Re: Type func binding and interfaces

2018-04-23 Thread matthewjuran
> > But I don't want to tie my users down to integers and floats. What if they > want to sort strings? What if they want to sort complex numbers, matrixes, > or what have you? This is what the interface concept was made for. Why would the implementation of IsLeft be different if the BAST

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

2018-04-23 Thread takanao ENDOH
Hi, guys. Could not `go get golang.org/x/lint/golint`. Is it working normally? Seems it was removed some packages from https://go.googlesource.com/ . webcache: http://webcache.googleusercontent.com/search?q=cache%3Ago.googlesource.com%2F Thanks for your checking. -- You received this message

Re: [go-nuts] Re: Accessing Slices Made From Same Array Concurrently

2018-04-23 Thread roger peppe
You original example has a problem that others have pointed out because it's possible for one goroutine to step on the part of the backing array used by others. In principle though your technique looks OK to me as long as you prevent that happening, for example by using the three-value slice

[go-nuts] Re: Type func binding and interfaces

2018-04-23 Thread matthewjuran
This is a code smell for me: type BAST interface { AddRow() error IsLeft(interface{}, Cursor) bool IsRight(interface{}, Cursor) bool IsEqual(interface{}, Cursor) bool IsEmpty(Cursor) bool … Interfaces should be small. This looks like a class definition which isn’t a Go

[go-nuts] Re: Accessing Slices Made From Same Array Concurrently

2018-04-23 Thread Kaveh Shahbazian
Also -race does not complain about this: https://play.golang.org/p/IeA4npcemf5 On Monday, April 23, 2018 at 10:51:05 AM UTC+4:30, Kaveh Shahbazian wrote: > > @Silviu The code is mutating same item from two goroutines. While the > original target is to create a buffer pool that their items is

[go-nuts] Re: Global variable not used, but it works fine

2018-04-23 Thread Vladimir Varankin
I think it's way harder to guaranty that the globals aren't used since even non-exported functions/varibles can be used by the linker. On Saturday, April 21, 2018 at 3:30:22 PM UTC+2, 子風 wrote: > > What did you do? > https://play.golang.org/p/aryK9Btv5kH > > What did you expect to see?

[go-nuts] Re: Type func binding and interfaces

2018-04-23 Thread Louki Sumirniy
I spent two hours wrestling with this, but as you can see in this playground, the method I proposed totally works: https://play.golang.org/p/FMvisWS9tuP I propose that the type builtin when dealing with functions should have an extension made to it to add the method binding to the type

[go-nuts] Problem using ReadFromUDP on Windows to discover local peers

2018-04-23 Thread zack . scholl
I wrote a library (schollz/peerdiscovery ) for discovering peers on a local network. I've tested it between a wireless ubuntu laptop and a wired ubuntu server and it works great. Basically you can run the following on computer 1 and computer 2: go

[go-nuts] liteide x33.3 released

2018-04-23 Thread visualfc
Hi all. LiteIDE x33.3 released! This version support import line jump to package source file, support import hints for all package (GOPATH / vendor) on code completer. Refactor debug, move golang Debug/DebugTest to build menu, fix build debug gcflags for selected go version, and better support

[go-nuts] Re: Avoiding html/template's escaping of the + in

2018-04-23 Thread Ben Bullock
On Sunday, 1 April 2018 05:47:09 UTC+9, iv...@vucica.net wrote: > > > This still gets escaped: > > https://play.golang.org/p/eZxQrHy1vCE > > Is this a bug? How do I avoid html/template escaping this, while still > escaping > href? > Use text/template and explicitly escape the things which need

[go-nuts] Re: New tutorial:Code a simple P2P blockchain in Go!

2018-04-23 Thread Ryan Yogan
Absolutely fantastic! The series of articles were fun to work through, and, for once the subject matter of block-chains just clicked for me! On Saturday, April 14, 2018 at 7:53:09 PM UTC-7, no...@mycoralhealth.com wrote: > > >

[go-nuts] Re: Accessing Slices Made From Same Array Concurrently

2018-04-23 Thread Kaveh Shahbazian
@Silviu The code is mutating same item from two goroutines. While the original target is to create a buffer pool that their items is not being mutated from two goroutines - actually they can not do that because at a specific time only one goroutine has access to one buffer. @Tamas Regarding