Re: [go-nuts] GolangRT Docs?

2017-01-24 Thread Ian Lance Taylor
On Tue, Jan 24, 2017 at 12:46 PM, josvazg wrote: > > Golang runtime has been fully translated to Go for a while now. I know I > could just read the source code directly but... > > Is there any known or recommended documentation (talk, slides, article) > about the runtime Go

Re: [go-nuts] Array Join Fail vs Slice Join Success

2017-01-26 Thread Ian Lance Taylor
On Thu, Jan 26, 2017 at 7:45 AM, wrote: > var s [2]string > s[0] = "PASS" > s[1] = "FAIL" > fmt.Println(strings.Join(s, ",")) > > > The following code fails, I know this works with a slice, But I am a newbie > to go and I am trying to figure out the reason why this fails?

Re: [go-nuts] GolangRT Docs?

2017-01-26 Thread Ian Lance Taylor
On Thu, Jan 26, 2017 at 9:18 AM, T L <tapir@gmail.com> wrote: > > On Wednesday, January 25, 2017 at 5:16:07 AM UTC+8, Ian Lance Taylor wrote: > >> By not allocating memory. It is helped by a "secret" compiler option, >> -+. When that compiler option

Re: [go-nuts] GolangRT Docs?

2017-01-26 Thread Ian Lance Taylor
On Thu, Jan 26, 2017 at 11:10 AM, T L wrote: > > I still don't understand what are implicit memory allocations, could you > make an explanation? An example of an implicit memory allocation: var globalVar *int func f() { var i int globalVar = } Another one: var

Re: [go-nuts] GolangRT Docs?

2017-01-25 Thread Ian Lance Taylor
On Wed, Jan 25, 2017 at 12:40 AM, josvazg wrote: > > Here are my takeaways (with a few questions): > > There is not a clearly defined GolangRT subset (at least for now), it is a > moving target requiring very low level knowledge on the compiler inner > workings. > For the

Re: [go-nuts] timer Reset concurrent to receive

2017-01-25 Thread Ian Lance Taylor
On Wed, Jan 25, 2017 at 9:34 AM, 'Tim Hockin' via golang-nuts wrote: > I'm not convinced that the docs quite cover the case I am looking, so > I am posting here. > > https://golang.org/pkg/time/#Timer.Reset says "This should not be done > concurrent to other receives

Re: [go-nuts] Is Go too strict for nesting function callings?

2017-01-25 Thread Ian Lance Taylor
On Wed, Jan 25, 2017 at 5:05 PM, John Souvestre wrote: > > Thanks! I see both the limitation and the exception. > > Other than implementation complexity, is there a reason for the limitation of > single-valued expressions? Is there some fundamental problem with allowing >

Re: [go-nuts] Is there any import path limitation when using go:linkname localname importpath.name?

2017-01-20 Thread Ian Lance Taylor
On Fri, Jan 20, 2017 at 12:16 AM, Cholerae Hu wrote: > I removed the alias "pri", and it works, thanks! > By the way, when go:linkname with runtime, why don't I need to import > "runtime" package explicitly? The runtime package is always imported implicitly by every Go

Re: [go-nuts] testing.Benchmark Unanswered StackOverflow question. Looks like a bug.

2017-01-27 Thread Ian Lance Taylor
On Fri, Jan 27, 2017 at 1:15 AM, Ilya Kostarev wrote: > Just this > http://stackoverflow.com/questions/41861918/using-testing-benchmark-does-not-produce-any-output > Citation > > package main > > import "testing" > > func main() { > > result :=

Re: [go-nuts] timer Reset concurrent to receive

2017-01-25 Thread Ian Lance Taylor
al race with the other receive. I mean, we can make the docs arbitrarily complicated, but at some point it should be on the wiki or something. Ian > On Wed, Jan 25, 2017 at 10:20 AM, Ian Lance Taylor <i...@golang.org> wrote: >> On Wed, Jan 25, 2017 at 9:34 AM, 'Tim Hockin' via golang-

Re: [go-nuts] timer Reset concurrent to receive

2017-01-25 Thread Ian Lance Taylor
s for this package are the place to discuss them. Ian > On Wed, Jan 25, 2017 at 11:21 AM, Ian Lance Taylor <i...@golang.org> wrote: >> On Wed, Jan 25, 2017 at 10:30 AM, Tim Hockin <thoc...@google.com> wrote: >>> Thanks! That makes sense. Does it make sense to update the

Re: [go-nuts] Does Go spec assure that a substring shares the underlying bytes with the original string?

2017-02-20 Thread Ian Lance Taylor
On Mon, Feb 20, 2017 at 9:12 AM, T L wrote: > > I know gc assures this, but I don't know if it is compiler specified or a > spec rule. I can't think of any way that a Go program that does not unsafe could detect whether a string slice uses the same memory as the string being

Re: [go-nuts] How to Build and Install Go 1.7.4 in OpenBSD 5.9

2017-02-20 Thread Ian Lance Taylor
On Mon, Feb 20, 2017 at 2:55 AM, Srikanth Chandika wrote: > How to Build and Install Go 1.7 from go src code in OpenBSD 5.9. It's no different from building Go from source on any other system. https://golang.org/doc/install/source Note that the current release is now

Re: [go-nuts] How do you implement and use Context.Done?

2017-02-20 Thread Ian Lance Taylor
On Sun, Feb 19, 2017 at 2:57 PM, wrote: > Thanks, I see you build it up with decorators on a standard prototype. > For example: https://play.golang.org/p/PJy5lE9QqF > > So context.Done is a convenience function for those that require it? > Otherwise a context will expire

Re: [go-nuts] Argument types of: anonymous function literals used as arguments of other function calls

2017-02-20 Thread Ian Lance Taylor
On Mon, Feb 20, 2017 at 6:44 AM, Marco Ippolito wrote: >> Are you asking for the language to be changed to allow it? > > Yes. Some previous discussion in this thread: https://groups.google.com/d/msg/golang-nuts/Kfm4t3TShTY/9mH173ZiReIJ . The way to pursue this would be to

go test -race much slower in 1.8 (was Re: [go-nuts] Go 1.8 is released)

2017-02-20 Thread Ian Lance Taylor
On Mon, Feb 20, 2017 at 12:06 PM, Will Newton wrote: > On Thu, Feb 16, 2017 at 9:01 PM, Chris Broadfoot wrote: >> Hello gophers, >> >> We just released Go 1.8. >> >> You can read the announcement blog post here: >> https://blog.golang.org/go1.8 >> >> You

Re: [go-nuts] int16 and float64 Multiplication

2017-02-18 Thread Ian Lance Taylor
On Sat, Feb 18, 2017 at 7:52 PM, wrote: > I am trying to multiply an int16 and float64 in Golang 1.8 but the result it > returns is incorrect. I need this number to be exact for some hash > verification. Any ideas why this might be happening? > > int16(10) // 10 >

Re: [go-nuts] Early hooking runtime - making libcontainer cross compilable

2017-02-17 Thread Ian Lance Taylor
On Fri, Feb 17, 2017 at 1:55 PM, Steven Hartland wrote: > Recently we started adding support to our systems for opencontainers via > libcontainer however due to its use of C code for the early hooking this > means we now can't cross-compile our code any more, which is a

Re: [go-nuts] How do you implement and use Context.Done?

2017-02-17 Thread Ian Lance Taylor
On Fri, Feb 17, 2017 at 1:34 PM, wrote: > I'm not sure how to implement and use the Done function and its returned > channel for contexts. > https://golang.org/pkg/context/#Context > > The comments say to refer to https://blog.golang.org/pipelines, but I didn't > see any

Re: [go-nuts] Go Roadmap

2017-02-17 Thread Ian Lance Taylor
On Fri, Feb 17, 2017 at 12:28 PM, Tharaneedharan Vilwanathan wrote: > > I have trouble getting to know whats coming up in future Go releases. > > Can someone tell me where to find this info? > > For example, where can I see whats new in Go 1.9? See this thread in golang-dev:

Re: [go-nuts] Early hooking runtime - making libcontainer cross compilable

2017-02-17 Thread Ian Lance Taylor
On Fri, Feb 17, 2017 at 3:22 PM, Steven Hartland wrote: > > That said after fork we only have a single thread, so it should be possible > to perform these actions safely if it where possible to run arbitrary > actions via SysProcAttr and care was taken. We are never going

Re: [go-nuts] offset out of range, different toolchain

2017-02-23 Thread Ian Lance Taylor
On Thu, Feb 23, 2017 at 12:54 PM, wrote: > I am trying to switch from a 32 bit standalone ndk android toolchain to the > 64 bit one. The only changes I have made are the toolchain and using > GOARCH=arm64 instead of GOARCH=arm when build but I am getting a list of >

Re: [go-nuts] 1.8 plugins and ABI

2017-02-23 Thread Ian Lance Taylor
On Thu, Feb 23, 2017 at 4:45 PM, 'Tim Hockin' via golang-nuts wrote: > > I can't seem to find this documented, and I'm me involved in some > conversations about using plugins: > > What guarantees or limitations surround plugins? Can I compile a host > program with

Re: [go-nuts] Support for the race detector on ARM

2017-02-23 Thread Ian Lance Taylor
On Thu, Feb 23, 2017 at 9:45 AM, Owen Waller wrote: > > I am assuming that the race detector is not yet supported on ARM hardware. > Having just tried to cross compile some code I am seeing: > > go build: -race and -msan are only supported on linux/amd64, freebsd/amd64, >

Re: [go-nuts] Go Language tests

2017-02-24 Thread Ian Lance Taylor
On Fri, Feb 24, 2017 at 4:51 PM, wrote: > > I am testing Go language on Nano Server. > > Are there any Acceptance tests or tests the Go team has created to tests Go > builds? > > If possible I would like to run these tests on Nano Server. Are you looking for any specific

Re: [go-nuts] Why dont the Marshal & Unmarshal use same amount of arguments and return values

2017-02-23 Thread Ian Lance Taylor
On Thu, Feb 23, 2017 at 4:42 AM, Jianhua Li wrote: > func Marshal(v interface{}) ([]byte, error) > > func Unmarshal(data []byte, v interface{}) error > > > Why dont the Marshal & Unmarshal use same amount of arguments, and same > amount of return values like one of these. > > >

Re: [go-nuts] Using the Plugin Feature in Go 1.8

2017-02-23 Thread Ian Lance Taylor
On Thu, Feb 23, 2017 at 5:24 AM, dc0d wrote: > Is the plugin feature in Go 1.8, production ready? > > Or is it experimental? On slack Andrei Tudor Călin led me to the list of > current issues with plugins, which is somehow daunting. BTW even providing > just functions

Re: [go-nuts] Distribution of Go by ActiveState

2017-02-17 Thread Ian Lance Taylor
On Fri, Feb 17, 2017 at 5:55 AM, wrote: > > allthough I'm not an Open Source or licencing expert I wonder if the planned > Go distribution with commercial support is legal by Go's license terms: > Here's a link to it: http://www.activestate.com/go > > I just wanted to

Re: [go-nuts] Go 1.8 : cmd/go : test timed out after 3m0s

2017-02-17 Thread Ian Lance Taylor
On Fri, Feb 17, 2017 at 3:28 AM, Peter Kleiweg wrote: > Installing Go 1.8 with: > > git pull > git checkout go1.8 > cd src > GOROOT_BOOTSTRAP=/path/to/go1.4 ./all.bash > > I get this: > > panic: test timed out after 3m0s > (stacktrace) > FAIL

Re: [go-nuts] Go Compiler Intermediate Representation

2017-02-21 Thread Ian Lance Taylor
On Tue, Feb 21, 2017 at 9:15 AM, Arpit Aggarwal wrote: > > I am doing a project in which I need Go compiler's intermediate > representation(IR) (which is semantics preserving and I can get all all info > like line number and data type and other features) (human readable)

Re: [go-nuts] Re: Trying to understand := and named return values

2017-02-21 Thread Ian Lance Taylor
On Tue, Feb 21, 2017 at 1:46 PM, wrote: > Seems like named returns + if/for/switch initializers = a shadowing > nightmare. I wish the Go compiler emitted a loud warning on shadowing, as > this is a dangerously subtle problem out there. Yes, named returns may have

Re: [go-nuts] How do you implement and use Context.Done?

2017-02-21 Thread Ian Lance Taylor
On Tue, Feb 21, 2017 at 11:15 AM, Thomas Bushnell, BSG <tbushn...@google.com> wrote: > On Mon, Feb 20, 2017 at 11:42 AM Ian Lance Taylor <i...@golang.org> wrote: >> >> On Sun, Feb 19, 2017 at 2:57 PM, <so.qu...@gmail.com> wrote: >> > Thanks, I see you

Re: [go-nuts] How do you implement and use Context.Done?

2017-02-21 Thread Ian Lance Taylor
On Tue, Feb 21, 2017 at 12:45 PM, Ian Lance Taylor <i...@golang.org> wrote: > On Tue, Feb 21, 2017 at 11:15 AM, Thomas Bushnell, BSG > <tbushn...@google.com> wrote: >> On Mon, Feb 20, 2017 at 11:42 AM Ian Lance Taylor <i...@golang.org> wrote: >>> >&

Re: [go-nuts] flag: possible issue with intValue.Set

2017-02-21 Thread Ian Lance Taylor
On Tue, Feb 21, 2017 at 9:51 AM, Manlio Perillo wrote: > I have noted that the intValue (and uintValue) Set method do the following: > v, err := strconv.ParseInt(s, 0, 64) > > However this is incorrect on 32 bit systems: > https://play.golang.org/p/tvAUCI63x3 > > Can

Re: [go-nuts] How to Build and Install Go 1.7.4 in OpenBSD 5.9

2017-02-20 Thread Ian Lance Taylor
recisely do you do? What precisely happens? Note that I don't know anything about what is in openbsd/ports. I don't see that string anywhere in the standard Go source code. Ian > On Tue, Feb 21, 2017 at 1:13 AM, Ian Lance Taylor <i...@golang.org> wrote: >> >> On Mon, Feb

[go-nuts] Re: Unsafe string/slice conversions

2017-02-21 Thread Ian Lance Taylor
On Tue, Feb 21, 2017 at 2:53 PM, Caleb Spare wrote: > I have a program that uses unsafe in order to coerce some slices to > strings for use as map keys. (Avoiding these allocations ends up being > an important performance optimization to this program.) > > Here's some example

Re: [go-nuts] how to locate the function definition of golang source code?

2017-02-22 Thread Ian Lance Taylor
On Wed, Feb 22, 2017 at 12:22 AM, Jiajun Huang wrote: > Hello, I'm reading golang source code, it's in version 1.8. some times, I > got some functions like: (runtime/proc.go, function main): > >107 func main() { >108 g := getg() >109 >110 // Racectx of

Re: [go-nuts] Writing safe CGO calls and callbacks and how that affects system threads

2017-02-13 Thread Ian Lance Taylor
On Mon, Feb 13, 2017 at 1:14 PM, wrote: > On Monday, February 13, 2017 at 7:02:22 AM UTC+1, Luka Napotnik wrote: >> >> I forgot to mention that the main goroutine in the test program is locked >> to a thread as I call runtime.LockOSThread() in init() > > > The Go Spec says

Re: [go-nuts] efficiency of string <-> []byte conversion

2017-02-13 Thread Ian Lance Taylor
On Mon, Feb 13, 2017 at 12:31 PM, Alex Flint wrote: > > As of go1.8, do conversions between strings and byte slices always generate > a copy? Usually but not absolutely always. The gc compiler has an optimization for map lookups. For a map[string]T, when s is a []byte,

Re: [go-nuts] Re: How could the body for a func be "provided by runtime"?

2017-02-09 Thread Ian Lance Taylor
On Thu, Feb 9, 2017 at 4:16 PM, Sina Siadat wrote: > > One thing I still don't understand is the cases when go:linkname is needed. > Why not just import that package, if the function is exported. Is it only > used for accessing unexported functions? Yes. It's primarily a hack

Re: [go-nuts] Where can I get the markdown source code of effective_go.html?

2017-02-09 Thread Ian Lance Taylor
On Thu, Feb 9, 2017 at 3:03 PM, oscaretu wrote: > > I've searching in Google and browsing and searching in the golang GitHub > repository, but I've unable to find the markdown source code used to > generate the HTML file effective_go.html There isn't any. That file has

Re: [go-nuts] The feature I want most, weak *

2017-02-09 Thread Ian Lance Taylor
On Thu, Feb 9, 2017 at 4:46 PM, wrote: > > I'll look into that api and maybe it will solve my problems. Though, to be > understood I'm not asking for ARC, I'm asking for a keyword so the spec is > compatible with ARC. But you don't need a keyword to get weak pointers.

Re: [go-nuts] Any suggestions for slow compile times in 1.7.x and 1.8?

2017-02-14 Thread Ian Lance Taylor
On Tue, Feb 14, 2017 at 3:26 PM, Mi-e Foame wrote: > > Like I said before, most of the Go programs I've compiled in the past are > usually built within a few seconds at most. I'm not sure what about Go 1.7 > and 1.8 could make such a huge difference in compile times. Any

Re: [go-nuts] xattrib on symlinks and holes in syscall support

2017-02-14 Thread Ian Lance Taylor
On Mon, Feb 13, 2017 at 4:45 PM, 'simon place' via golang-nuts wrote: > i have been tidying up some xattrib (extended file attribute) code, and had > what i thought was a cool idea. > > that idea used xattribs on symlinks. > > but when i tried this i found that

Re: [go-nuts] Writing safe CGO calls and callbacks and how that affects system threads

2017-02-12 Thread Ian Lance Taylor
On Sun, Feb 12, 2017 at 9:57 PM, Luka Napotnik wrote: > Thanks for the reply. I've created a test program with function F1 that > calls a C function F2. The function F2 then calls a Go function F3. > > I've started the test once with GOMAXPROCS set to 1, and the second time >

Re: [go-nuts] The feature I want most, weak *

2017-02-12 Thread Ian Lance Taylor
On Fri, Feb 10, 2017 at 10:04 PM, Keynan Pratt wrote: > Yes it CAN be implemented that way, but that throws away type information, > and makes code less readable. The question of compile-time type information boils down to the generics issue. > It also seems to conflate

Re: [go-nuts] Writing safe CGO calls and callbacks and how that affects system threads

2017-02-12 Thread Ian Lance Taylor
On Sun, Feb 12, 2017 at 1:47 AM, wrote: > Hello. I have a Go program that calls C functions in order to create a Gtk+ > GUI. Because Gtk+ itself isn't thread-safe, I'm wondering if it's even > possible to write GUI apps this way since there's no guarantee that the same > thread

Re: [go-nuts] Facing Issues while Installing Go1.7 from source code on OpenBSD 5.9

2017-02-10 Thread Ian Lance Taylor
On Thu, Feb 9, 2017 at 9:41 PM, Srikanth Chandika wrote: > > I am facing issues while compiling go1.7 from src code. I am trying to > install go1.7 on OpenBSD 5.9. I am facing below issues. > > --- FAIL: TestGoroutineParallelism2 (0.34s) > panic: runtime error: invalid

Re: [go-nuts] Re: How could the body for a func be "provided by runtime"?

2017-02-09 Thread Ian Lance Taylor
On Thu, Feb 9, 2017 at 5:19 AM, Sina Siadat wrote: > Thank you! > > To make sure I understand what is going on I tried to reproduce the same > thing. But I can't get the compiler to find the definition of my function > even though I used the compiler directive here > >

Re: [go-nuts] The feature I want most, weak *

2017-02-09 Thread Ian Lance Taylor
On Thu, Feb 9, 2017 at 1:26 AM, wrote: > The feature I want most in go is automatic reference counting. I don't > really care how mainline GC works but I want the language to be open to the > possibility of ARC-GC. In order for that to be able to handle cycles you > need a

Re: [go-nuts] Place of the Pointer type inside unsafe.package

2017-02-16 Thread Ian Lance Taylor
On Thu, Feb 16, 2017 at 8:50 AM, wrote: > Le jeudi 16 février 2017 17:46:15 UTC+1, Axel Wagner a écrit : >> >> The unsafe package is pretty much virtual. The compiler is aware of it and >> implements the operations defined by the spec to be in it. > > Is it the same for

Re: [go-nuts] how can i build a golang system library of debug version

2017-02-16 Thread Ian Lance Taylor
On Wed, Feb 15, 2017 at 11:29 PM, Wen Hailong <7234...@gmail.com> wrote: > i want to debug golang system library. can step code one by one Go programs are built with debugging info by default. You need to take special action to avoid the debugging info. But note https://golang.org/doc/gdb .

Re: [go-nuts] Re: weak hash for (MongoDb like) data server

2017-02-16 Thread Ian Lance Taylor
On Wed, Feb 15, 2017 at 9:42 PM, Basile Starynkevitch wrote: > > On Wednesday, February 15, 2017 at 9:01:58 PM UTC+1, Tamás Gulácsi wrote: > >> >> Why do you need this? >> You want the GC do the housekeeping for you, but I'm sure you won't be >> happy with the result, as

Re: [go-nuts] Are the tests in the Go source code considered "Unit" tests?

2017-02-15 Thread Ian Lance Taylor
On Tue, Feb 14, 2017 at 10:35 PM, wrote: > > From my understanding Unit Tests should focus on testing a single feature > and not use the filesystem. > > But in the Go source (https://github.com/golang/go) I saw several tests that > would violate those conditions. > > Should

Re: [go-nuts] How to run deferred function in main() on panic() in a goroutine?

2017-02-15 Thread Ian Lance Taylor
On Wed, Feb 15, 2017 at 10:43 AM, Yucong Sun wrote: > So, to give more background, i am trying to porting a C based > interpreter to Go. In the single threaded C code, the signal is > always handled by interrupting whatever code was executing and > directly exit after

Re: [go-nuts] How to run deferred function in main() on panic() in a goroutine?

2017-02-15 Thread Ian Lance Taylor
On Wed, Feb 15, 2017 at 10:26 AM, Yucong Sun wrote: > Also, my cleanup function must be tied directly with C loop, because > they are sharing the same underlaying memory/state . If I directly > run cleanup() while C loop was running, there could be race. > > So that leaves

Re: [go-nuts] go/types.Typ is a slice-of-pointer-to-struct yet uses map syntax

2017-02-15 Thread Ian Lance Taylor
On Wed, Feb 15, 2017 at 11:08 AM, Will Faught wrote: > The go/types.Typ decl: > > var Typ = []*Basic{ > Invalid: {Invalid, 0, "invalid type"}, > > Bool: {Bool, IsBoolean, "bool"}, > Int: {Int, IsInteger, "int"}, >

Re: [go-nuts] How to run deferred function in main() on panic() in a goroutine?

2017-02-15 Thread Ian Lance Taylor
On Wed, Feb 15, 2017 at 12:35 AM, wrote: > > I have a situation that need some advice. I have a main loop that is calling > some C code (potentially looping forever). and I need to handle signals > like SIGABRT correctly by ensuring a cleanup function was run. > > func main() {

Re: [go-nuts] Why is passing a pointer to a pointer in cgo dissalowed?

2017-01-23 Thread Ian Lance Taylor
On Mon, Jan 23, 2017 at 3:57 AM, wrote: > The doc for cgo states ... > > "Go code may pass a Go pointer to C provided the Go memory to which it > points does not contain any Go pointers. The C code must preserve this > property: it must not store any Go pointers in Go

Re: [go-nuts] Question about data race

2017-01-19 Thread Ian Lance Taylor
On Thu, Jan 19, 2017 at 7:05 PM, xiaohai dai wrote: > I am reading "Data Race Detector" from Godoc. > However, I'm confused by the example: Primitive unprotected variable > displayed in the post. I don't know why this example could lead to data > race. The assumption is

Re: [go-nuts] Question about data race

2017-01-19 Thread Ian Lance Taylor
17年1月20日星期五 UTC+8下午1:03:07,Ian Lance Taylor写道: >> >> On Thu, Jan 19, 2017 at 7:05 PM, xiaohai dai <seaf...@gmail.com> wrote: >> > I am reading "Data Race Detector" from Godoc. >> > However, I'm confused by the example: Primitive unprotected variable

Re: [go-nuts] Is there any import path limitation when using go:linkname localname importpath.name?

2017-01-19 Thread Ian Lance Taylor
On Wed, Jan 18, 2017 at 6:55 PM, Cholerae Hu wrote: > I'm trying to play with go:linkname, and I wrote a demo for this. > > directory structure: > > [test]$ tree > . > ├── main.go > ├── pri > │ └── a.go > └── pub > ├── issue15006.s > └── b.go > > a.go: > > package

Re: [go-nuts] Can somebody explain the importance of 'select'?

2017-01-19 Thread Ian Lance Taylor
On Thu, Jan 19, 2017 at 9:33 AM, John C. wrote: > On several occasions the Go designers have alluded to the fact that the > 'select' mechanism and the fact that it's built in to the language are very > important for concurrency (can't seem to find references). While I >

Re: [go-nuts] runtime: split stack overflow

2016-08-18 Thread Ian Lance Taylor
On Thu, Aug 18, 2016 at 6:56 AM, wrote: > > i'm trying to replace a Go signal handler by a C signal handler and try to > call the stored Go handler inside that C handler. It works well on Linux, > but on Darwin I receive a "runtime: split stack overflow" exception. Is

Re: [go-nuts] Weired or not?

2016-08-19 Thread Ian Lance Taylor
On Thu, Aug 18, 2016 at 10:16 PM, T L wrote: > > package main > > type S1 struct { } > > func (*S1) f() {} > > type S2 struct { S1 } > > // var _ = S1.f // S1.f undefined (type S1 has no method f) > // var _ = S2.f // S2.f undefined (type S2 has no method f) > var _ = (*S2).f

Re: [go-nuts] Unary +

2016-08-19 Thread Ian Lance Taylor
On Fri, Aug 19, 2016 at 12:54 PM, Rob Thornton wrote: > What is the purpose of the unary '+' operator? In both C and Go they are > syntactically correct but neither generate instructions to modify the > expression. This is not an entirely serious answer, but the unary

Re: [go-nuts] Unary +

2016-08-20 Thread Ian Lance Taylor
On Sat, Aug 20, 2016 at 1:24 PM, Bakul Shah wrote: > > In Go there are two issues: > The compiler refuses to divide by the constant 0.0 — This operation has a > well defined meaning but the compiler thinks it knows best (this behavior is > documented in the spec, which is

Re: [go-nuts] Status of golang.org/x/text/currency (github.com/golang/text)?

2016-08-04 Thread Ian Lance Taylor
[ +mpvl ] On Thu, Aug 4, 2016 at 2:07 AM, Johan Jian An Sim wrote: > There is no issue section in this repository to start a discussion. > > I would like to ask about the status of currency package. There seems to be > plan for further development according to the comments >

Re: [go-nuts] Re: Why doesn't std lib use the method in this article to make err variables constant?

2016-08-04 Thread Ian Lance Taylor
On Thu, Aug 4, 2016 at 8:43 AM, T L wrote: > > On Thursday, August 4, 2016 at 1:48:32 PM UTC+8, Dave Cheney wrote: >> >> Because we cannot change symbols covered by the Go 1 contract. > > > Aha, you are the author of this article. Great article! > >> "cannot change symbols

Re: [go-nuts] Golang upgrade from 1.5 to 1.7.2

2016-08-22 Thread Ian Lance Taylor
On Mon, Aug 22, 2016 at 12:10 PM, Prateek Gaur wrote: > In order to use one of the go packages I updates my golang version from > 1.5.2 to 1.7. > > But after update my go binaries seem to be segfaulting with following output > : > [1]19583 segmentation fault (core dumped)

Re: [go-nuts] Why is Go Unicode concat so slow compared to Python3 ?

2017-02-27 Thread Ian Lance Taylor
On Mon, Feb 27, 2017 at 6:40 PM, Shubha Ramani wrote: > mysetup is being called here: > > times = timeit.Timer(stmt="from __main__ import > concat",setup="gc.enable();from __main__ import mysetup").repeat(7,loops) > > Look at "from __main__ import mysetup" after

[go-nuts] Re: Building golang on MIPS using gccgo

2017-02-28 Thread Ian Lance Taylor
On Tue, Feb 28, 2017 at 7:33 AM, James Cowgill <james.cowg...@imgtec.com> wrote: > > Stumbling over this thread: > https://groups.google.com/forum/#!topic/golang-nuts/waTy56I_KWQ > > On 25/03/16 17:08, Ian Lance Taylor wrote: >> mipsn64 is a GOARCH value used by gc

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

2017-02-28 Thread Ian Lance Taylor
On Tue, Feb 28, 2017 at 9:05 AM, Fraser Hanson wrote: > https://play.golang.org/p/05wZM9BhfB > > I'm working on some code that reads UTF32 and converts it to go strings. > I'm finding some surprising behavior when casting slices of runes to > strings. > > runes :=

[go-nuts] Re: Building golang on MIPS using gccgo

2017-02-28 Thread Ian Lance Taylor
On Tue, Feb 28, 2017 at 9:41 AM, James Cowgill <james.cowg...@imgtec.com> wrote: > > On 28/02/17 17:30, Ian Lance Taylor wrote: >> On Tue, Feb 28, 2017 at 7:33 AM, James Cowgill <james.cowg...@imgtec.com> >> wrote: >>> >>> Stumbling over this thr

Re: [go-nuts] plugin questions....

2017-02-28 Thread Ian Lance Taylor
On Tue, Feb 28, 2017 at 12:44 PM, Basile Starynkevitch wrote: > > A few questions and wishes about plugins (Go1.8 Linux/amd64) Sorry, but you need to indicate whether you are talking about -buildmode=plugin (an experimental option to build plugins that may be opened by

Re: [go-nuts] Debugging in Go 1.8

2017-03-01 Thread Ian Lance Taylor
On Wed, Mar 1, 2017 at 5:41 AM, Nyah Check wrote: > I'm currently reading the Go 1.8 release documentation; I've not seen any > additional tools to facilitate Go debugging. I've mostly been comfortable > with delve. But I just wish to know if the golang-devs have any plans

Re: [go-nuts] plugin questions....

2017-03-01 Thread Ian Lance Taylor
On Tue, Feb 28, 2017 at 10:55 PM, Basile Starynkevitch <bas...@starynkevitch.net> wrote: > > On Wednesday, March 1, 2017 at 7:17:42 AM UTC+1, Ian Lance Taylor wrote: >> >> On Tue, Feb 28, 2017 at 12:44 PM, Basile Starynkevitch >> <bas...@starynkevitch.net>

Re: [go-nuts] Build constraints exclude go:binary-only-package directive?

2016-08-22 Thread Ian Lance Taylor
On Mon, Aug 22, 2016 at 2:57 PM, Joshua Liebow-Feeser wrote: > > According to the documentation, the //go:binary-only-package directive is > only used when the file is "not excluded by build constraints." However, I > have the following source: > > // +build !build_source > >

Re: [go-nuts] Generating x/sys/unix cross-platform

2016-08-22 Thread Ian Lance Taylor
On Mon, Aug 22, 2016 at 2:45 PM, <ellio...@gmail.com> wrote: > > A few months ago I asked about adding a new struct type to syscall. > (https://groups.google.com/d/msg/golang-nuts/5HTN3QVC_lQ/QuYxNl5UAgAJ) and I > got a great answer from Ian Lance Taylor that it would make se

Re: [go-nuts] Syntax errors involving compound literals

2016-08-24 Thread Ian Lance Taylor
On Wed, Aug 24, 2016 at 9:21 PM, sbkim via golang-nuts wrote: > Hello group, > > Why are the following snippets errors? > > https://play.golang.org/p/mgEYMNNw9h > type S struct { > i int > } > > if S{i: 0} == S{} { > } > syntax error: unexpected == at end of

Re: [go-nuts] Cgo Pointer Arithmetic

2016-08-31 Thread Ian Lance Taylor
On Wed, Aug 31, 2016 at 2:06 PM, Luke Mauldin wrote: > I modified my example based on the code example you gave at the bottom for > the pointer arithmetic and that compiled without any go vet errors. I > attempted to use the slice whose backing array is the C array >

Re: [go-nuts] Cgo Pointer Arithmetic

2016-08-31 Thread Ian Lance Taylor
On Wed, Aug 31, 2016 at 12:47 PM, Luke Mauldin wrote: > > I have questions about pointer arithmetic illustrated by this Play example: > https://play.golang.org/p/-cZteTY_M2 > > Questions: > 1) Is this the best way to do pointer arithmetic in Go to process a C array > and

Re: [go-nuts] unsupported GOOS/GOARCH pair darwin/x86_64 on mac installed from package

2016-08-31 Thread Ian Lance Taylor
On Wed, Aug 31, 2016 at 5:19 PM, Dan Kortschak wrote: > One of my users has struck a problem with an install of go1.7 from the > packages at [1] that has me baffled. I don't use a mac, so I've depleted > my knowledge of what might be going on here. Can anyone help?

Re: [go-nuts] About runtime.globrunqput/globrunqputhead

2016-08-31 Thread Ian Lance Taylor
On Wed, Aug 31, 2016 at 7:54 PM, Lin Hao wrote: > > I mean, sched.midle is a single linked list, but its mode of operation is > different from sched.runqhead/runqtail, why? (or, Why they used different > structure?) The midle list is a list of M's that aren't doing

Re: [go-nuts] `go test -i` considered helpful?

2016-09-01 Thread Ian Lance Taylor
On Thu, Sep 1, 2016 at 11:24 AM, 'Tim Hockin' via golang-nuts wrote: > I was running tests against a new project, and it was really slow. > When I ran with -x I saw a bunch of build steps that didn't seem to be > necessary. Spelunking through docs, reveals that `go

Re: [go-nuts] Go performance in regexdna

2016-09-01 Thread Ian Lance Taylor
On Thu, Sep 1, 2016 at 1:34 PM, DrGo wrote: > What is the reason for Go particularly poor performance in regexdna as shown > here? > https://benchmarksgame.alioth.debian.org/u64q/performance.php?test=regexdna In several past discussions of this topic the consensus has

Re: [go-nuts] Is there the incompatibility risk when using the XxxxPointer functions in sync/atomic package in later go versions?

2016-09-08 Thread Ian Lance Taylor
On Thu, Sep 8, 2016 at 3:46 AM, T L <tapir@gmail.com> wrote: > > On Thursday, September 8, 2016 at 12:33:37 AM UTC+8, Ian Lance Taylor wrote: >> >> On Wed, Sep 7, 2016 at 8:16 AM, T L <tapi...@gmail.com> wrote: >> > >> > On Wednesday, Septemb

Re: [go-nuts] asm newbie questions: missing stackmap

2016-08-30 Thread Ian Lance Taylor
On Tue, Aug 30, 2016 at 2:18 AM, chai2010 wrote: > The asm function `Sum` try call a Go function `sum`, > when the `sum` need morestack, it crashed: > > // main.go > func main() { > println(Sum(100)) > println(Sum(100 * 1000)) // panic! > } > > func Sum(n int) int > > func

Re: [go-nuts] src/log/log.go: What makes it expensive in this code of log.go?

2016-09-07 Thread Ian Lance Taylor
On Tue, Sep 6, 2016 at 9:00 AM, wrote: > > Hey, It's commented "release lock while getting caller info - it's > expensive" in source code of /src/log/log.go line:150. > > I'm confused with what makes it expensive if we didn't unlock the l.mu ? > Does goroutines have context

Re: [go-nuts] Behavior of calling (Context).Err without calling (Context).Done

2016-08-29 Thread Ian Lance Taylor
On Mon, Aug 29, 2016 at 4:21 PM, Stephen Day wrote: > Recently, we were examining some ill-structured code that called > (Context).Err() without first calling (Context).Done(). Typically, this > seems to return a nil error without any guarantees as to what that means, > but

Re: [go-nuts] In case you missed it: language benchmarks for Go 1.7, and language adoption

2016-08-29 Thread Ian Lance Taylor
On Mon, Aug 29, 2016 at 4:51 PM, 'Eric Johnson' via golang-nuts wrote: > > And then, for language adoption, the TIOBE language index for August of > 2016: > http://www.tiobe.com/tiobe-index/ > > (Note that the above is updated every six months, and I've not been able

Re: [go-nuts] type assertion on interface{} accepted practice?

2016-08-30 Thread Ian Lance Taylor
On Tue, Aug 30, 2016 at 4:11 PM, wrote: > > I see that interface{} is used in go's container/list > https://golang.org/src/container/list/list.go > > In using this container am I expected to type assert the element's Value? Yes. > And is this pattern of

Re: [go-nuts] About runtime.globrunqput/globrunqputhead

2016-08-31 Thread Ian Lance Taylor
On Tue, Aug 30, 2016 at 10:19 PM, Lin Hao wrote: > > I'm reading the runtime code, and there are some questions, as shown below: > > func globrunqput(gp *g) { > gp.schedlink = 0 > if sched.runqtail != 0 { > sched.runqtail.ptr().schedlink.set(gp)// My question: why? > >

Re: [go-nuts] I want to deep copy a map, how to get an enough initial size for the second parameter of make function?

2016-09-08 Thread Ian Lance Taylor
On Thu, Sep 8, 2016 at 8:19 AM, T L <tapir@gmail.com> wrote: > > On Thursday, September 8, 2016 at 10:57:10 PM UTC+8, Ian Lance Taylor wrote: >> >> On Thu, Sep 8, 2016 at 7:21 AM, T L <tapi...@gmail.com> wrote: >> > >> > On Thursday, Septem

Re: [go-nuts] Is there the incompatibility risk when using the XxxxPointer functions in sync/atomic package in later go versions?

2016-09-08 Thread Ian Lance Taylor
On Thu, Sep 8, 2016 at 8:16 AM, T L <tapir@gmail.com> wrote: > > On Thursday, September 8, 2016 at 10:50:36 PM UTC+8, Ian Lance Taylor wrote: >> >> On Thu, Sep 8, 2016 at 3:46 AM, T L <tapi...@gmail.com> wrote: >> > >> > On Thursday, Septembe

Re: [go-nuts] reading long text without newline from stdin

2016-09-09 Thread Ian Lance Taylor
On Fri, Sep 9, 2016 at 7:22 AM, wrote: > > I was trying to read a longer text from stdin, without any newline. I tried > it with many ways: fmt.Scan, bufio.NewScanner, bufio ReadLine, > ioutil.ReadAll. A sample code looks like this: >

Re: [go-nuts] What 5 things does Go need in 2017?

2016-09-11 Thread Ian Lance Taylor
On Sun, Sep 11, 2016 at 6:43 AM, Mark Richman wrote: > > I'm somewhat new to the community, and seek to understand its challenges > better. I'm also looking for opportunities to contribute. > > To that end, what 5 things does Go need in 2017? > > For example: language

Re: [go-nuts] Another divide by zero (float) question

2016-09-11 Thread Ian Lance Taylor
On Sun, Sep 11, 2016 at 11:40 AM, wrote: > https://play.golang.org/p/tLSyUw1Ojq > > This operation is caught by the compiler > > a:=float32(1) / float32(0) > > > ok This has been asked before - but not with a satisfactory answer afaict > > The spec says (

Re: [go-nuts] What 5 things does Go need in 2017?

2016-09-11 Thread Ian Lance Taylor
On Sun, Sep 11, 2016 at 6:44 PM, Mark Richman wrote: > > I would definitely be interested in triage, backlog refinement, etc. Are > there product owners designated for each functional area? I could start by > making sure new issues are at least assigned to the correct PO

Re: [go-nuts] Re: Can't understand untyped constant behavior

2016-09-11 Thread Ian Lance Taylor
On Sun, Sep 11, 2016 at 4:33 AM, Ilya Kostarev wrote: > > On 09/10/2016 09:18 PM, Manlio Perillo wrote: > > Il giorno giovedì 8 settembre 2016 17:31:55 UTC+2, Uvelichitel ha scritto: >> >> >> func main() { >> const x, y = 5, 3 >> var f float32 = x / y

<    1   2   3   4   5   6   7   8   9   10   >