Re: [go-nuts] import a "main" package

2017-10-24 Thread Dan Kortschak
The spec does preclude that since there must be a `package main`. https://golang.org/ref/spec#Program_execution On Wed, 2017-10-25 at 05:02 +, Alex Buchanan wrote: > Interesting, thanks. Let me try to clarify my idea with some simple > code: > > // file lives at github.com/buchanae/foobar/fo

Re: [go-nuts] import a "main" package

2017-10-24 Thread Alex Buchanan
Interesting, thanks. Let me try to clarify my idea with some simple code: // file lives at github.com/buchanae/foobar/foobar.go package foobar func Foobar() string { return "foobar" } func main() { print(Foobar()) } This file exports both a function to be used as a library, and a main funct

Re: [go-nuts] import a "main" package

2017-10-24 Thread Ian Lance Taylor
On Tue, Oct 24, 2017 at 8:14 PM, Alex Buchanan wrote: > > Is there documentation (or other) explaining why the main package must have > name "main" and may not be imported? Is this an important simplification for > the compiler? The language spec says that the main package must have the name main

Re: [go-nuts] import a "main" package

2017-10-24 Thread Alex Buchanan
Is there documentation (or other) explaining why the main package must have name "main" and may not be imported? Is this an important simplification for the compiler? I'd love it if a single "go get " represented both my library root and my command line binary. On Sunday, September 24, 2017 at

Re: [go-nuts] Re: awesome-go project on golang github organization

2017-10-24 Thread Dan Kortschak
I have similar sentiments. On Tue, 2017-10-24 at 09:19 -0700, prades.m...@gmail.com wrote: > I submitted several original projects i made to your list, they > passed all  > the tests, they sat in the pull-request list for 6 month then when > rejected  > for disingenuous or unspecified reasons.So I

Re: [go-nuts] Re: Pure Golang Android Service

2017-10-24 Thread Daniel Skinner
The manifest can specify hooks for Service implementations, such as to start on-boot, but the platform still requires the implementation of the Service class. One could write a generic NativeService implementation for easy reuse and launching of native processes, but otherwise nothing has changed w

Re: [go-nuts] Re: Go memory usage

2017-10-24 Thread Ian Lance Taylor
On Tue, Oct 24, 2017 at 12:38 PM, Juliusz Chroboczek wrote: > >> It depends entirely on your program. The simplest way to think about >> it is that the runtime imposes an overhead on the memory that your >> program allocates for its own data structures. If you think of that >> overhead as 10%, y

[go-nuts] Re: Pure Golang Android Service

2017-10-24 Thread Seth Moeckel
Has anything here changed? Given that Go mobile apps are really just Go apps, I wonder if a service could be made by simply having the correct manifest... On Monday, November 23, 2015 at 10:45:53 PM UTC-5, Regan Laitila wrote: > > Hello Everyone, > > I'm curious if it is possible to write an all

[go-nuts] Re: Go memory usage

2017-10-24 Thread Juliusz Chroboczek
> It depends entirely on your program. The simplest way to think about > it is that the runtime imposes an overhead on the memory that your > program allocates for its own data structures. If you think of that > overhead as 10%, you won't be very far wrong. How does that fit with GOGC being 100%

[go-nuts] Re: Go memory usage

2017-10-24 Thread Juliusz Chroboczek
> It depends entirely on your program. The simplest way to think about > it is that the runtime imposes an overhead on the memory that your > program allocates for its own data structures. If you think of that > overhead as 10%, you won't be very far wrong. How does that fit with GOGC being 100%

[go-nuts] Re: Running a Go server in a chroot

2017-10-24 Thread Juliusz Chroboczek
> you need /usr/local/go/lib/time/zoneinfo.zip. time.LoadLocation is using > it. Also /usr/local/go/lib/time/ has a script to refresh timezones. It turns out that copying /etc/localtime into the chroot was enough. Thanks to the person who helped me by private mail (he'll know who he is). -- Juli

Re: [go-nuts] a bug about go language

2017-10-24 Thread Justin Israel
On Wed, Oct 25, 2017, 2:56 AM Ian Lance Taylor wrote: > On Tue, Oct 24, 2017 at 5:18 AM, <2891132l...@gmail.com> wrote: > > > > So how to modify it? I don't know clearly.Would you mind helping ,me to > > solve this problem? > Using the SublimeText "build and run" is not really ideal for running

[go-nuts] Re: awesome-go project on golang github organization

2017-10-24 Thread prades . marq
I submitted several original projects i made to your list, they passed all the tests, they sat in the pull-request list for 6 month then when rejected for disingenuous or unspecified reasons.So I would prefer not your list becomes the official one. Le lundi 23 octobre 2017 17:20:00 UTC+2, Thiag

Re: [go-nuts] Re: Should you check error from ResponseWriter.Write()?

2017-10-24 Thread groenendaal92
Thank you all for all your help! My takeaway from this is that, generally, it is not beneficial to check the error from ResponseWriter.Write() since usually no action can be taken. On Monday, October 23, 2017 at 12:56:04 AM UTC-5, Tamás Gulácsi wrote: > > In thw concrete case, ResponseWriter.Wri

Re: [go-nuts] Go memory usage

2017-10-24 Thread Ben Barbour
Thanks Gabriel; I will check out the tools and do some tests. Also thanks for the info Ian. I didn't think a .so would save much in the long run, but I want to be able to throw some numbers at my boss if I pitch go as a C++ alternative for a project. On Tue, Oct 24, 2017, 7:47 AM Ian Lance Taylor

Re: [go-nuts] Go memory usage

2017-10-24 Thread Ian Lance Taylor
On Mon, Oct 23, 2017 at 11:11 AM, Ben Barbour wrote: > > I wrote a small go program and each instance of it takes about 10MB when > executed, according to top's global usage counter (not sure if this is a > great way of measuring...). The details of what it does aren't important for > now, but

[go-nuts] A tour of go - Since a couple days ago the line numbers started to render on the right side or the margin line (instead of left).

2017-10-24 Thread jarciuch via golang-nuts
Looks like this both on latest chrome and on firefox. Thanks, Jan -- You received this message because you are subscribed to the Google Groups "golang-nuts" g

Re: [go-nuts] Client library design for a WebSocket API and idiomatic Go

2017-10-24 Thread Ian Lance Taylor
On Tue, Oct 24, 2017 at 1:55 AM, 'Ray Scott' via golang-nuts wrote: > > I'm currently writing a client library for accessing a backend API, > everything is in > Go. From the Obj-C/Swift world that would look something like the first > example > below, where you'd pass a success and error closure

Re: [go-nuts] a bug about go language

2017-10-24 Thread Ian Lance Taylor
On Tue, Oct 24, 2017 at 5:18 AM, <2891132l...@gmail.com> wrote: > > So how to modify it? I don't know clearly.Would you mind helping ,me to > solve this problem? What problem? What do you expect to happen? The error message is telling you that the program expects an IP address on the command li

[go-nuts] Client library design for a WebSocket API and idiomatic Go

2017-10-24 Thread 'Ray Scott' via golang-nuts
I'm currently writing a client library for accessing a backend API, everything is in Go. From the Obj-C/Swift world that would look something like the first example below, where you'd pass a success and error closure to handle the 2 outcomes. The immediate error returned from the call would ind

Re: [go-nuts] a bug about go language

2017-10-24 Thread 2891132love
So how to modify it? I don't know clearly.Would you mind helping ,me to solve this problem? 在 2017年10月24日星期二 UTC+8下午3:06:00,Dave Cheney写道: > > The program you are trying to run requires an argument, an ip address > > On Tuesday, 24 October 2017 18:03:00 UTC+11, 28911...@gmail.com wrote: >> >> Sor

Re: [go-nuts] Re: will the following code always print two 1?

2017-10-24 Thread T L
On Monday, October 23, 2017 at 7:04:53 PM UTC-4, Keith Randall wrote: > > They are the lock count for the given lock. Imagine each lock keeps track > of how many times it has been acquired. > There is a happens-before edge from an unlock to a lock only if the unlock > has a lower count (i.e. w

[go-nuts] Re: Go memory usage

2017-10-24 Thread Gabriel Aszalos
Hey Ben, You can use the pprof and trace tools to find answers to those questions yourself. Some links: https://blog.golang.org/profiling-go-programs https://golang.org/pkg/runtime/trace/ https://github.com/pkg/profile justforfunc #22 also talks about using those tools (https://www.youtube.co

Re: [go-nuts] a bug about go language

2017-10-24 Thread Dave Cheney
The program you are trying to run requires an argument, an ip address On Tuesday, 24 October 2017 18:03:00 UTC+11, 28911...@gmail.com wrote: > > Sorry.I see the bug in Sublime Text3 and I can't find the errors.At the > sane time, I can't solve this problem.It's strange but it can run other > pro

Re: [go-nuts] a bug about go language

2017-10-24 Thread 2891132love
Sorry.I see the bug in Sublime Text3 and I can't find the errors.At the sane time, I can't solve this problem.It's strange but it can run other programmings. 在 2017年10月23日星期一 UTC+8下午11:28:20,Jan Mercl写道: > > On Mon, Oct 23, 2017 at 5:23 PM <28911...@gmail.com > wrote: > > what bug do you see and