Re: [go-nuts] How to properly get basename under DOS?

2016-06-14 Thread Ian Lance Taylor
On Tue, Jun 14, 2016 at 10:00 AM, Jan Mercl <0xj...@gmail.com> wrote: > Package path is for *nix paths only. import "path/filepath" instead. I agree that path/filepath is what you want, but I would say it slightly differently. path is for what you find inside URLs, path/filepath is for paths in

Re: [go-nuts] Re: broadcasting on a set of channels

2016-06-15 Thread Ian Lance Taylor
On Tue, Jun 14, 2016 at 10:15 PM, wrote: > > What happens if the channel closes? > > I'm thinking about maintaining a list of channels (one for each websocket > client), then sending a message to all of them. The only problem is that > when the websocket client disconnects,

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread Ian Lance Taylor
On Wed, Jun 22, 2016 at 6:50 AM, Manlio Perillo wrote: > On Wed, Jun 22, 2016 at 3:35 PM, Henrik Johansson > wrote: >> Really? > > Yes. > The problem is that many people coming from C like languages may > incorrectly assume that i is a floating

Re: [go-nuts] net.ListenUDP, ListenTCP & new go routine creation

2016-06-20 Thread Ian Lance Taylor
On Sat, Jun 18, 2016 at 10:17 PM, Manohar Kumar wrote: > > Is it possible that a net.ListenTCP or ListenUDP call can result in new go > routine/OS thread creation ? I guess not all system calls result in a new go > routine (and OS thread if necessary) creation. But

Re: [go-nuts] Go test to run over sub packages?

2016-06-21 Thread Ian Lance Taylor
On Tue, Jun 21, 2016 at 12:42 PM, wrote: > Is `$ go test github.com/foo/proj/...` really supposed to work? Yes. > When I run it I get > > warning: "github.com/foo/proj/..." matched no packages > no packages to test > > But `cd src/github.com/foo/proj && go test ./...`

Re: [go-nuts] Is there any overhead to casting a pointer (or uintptr) to and from unsafe.Pointer? Can uintptr be safely used to reference an object?

2016-06-20 Thread Ian Lance Taylor
On Mon, Jun 20, 2016 at 10:39 AM, Jason E. Aten wrote: > This does raise an interesting question: how should one detect cycles in a > graph of Go objects, in a garbage-collection safe manner? > > I am using reflect.ValueOf(x).Pointer() at the moment (which gives an > uintptr),

Re: [go-nuts] net.ListenUDP, ListenTCP & new go routine creation

2016-06-20 Thread Ian Lance Taylor
On Mon, Jun 20, 2016 at 8:09 PM, Matt Harden wrote: > OK, wait. You mentioned namespaces. It is definitely not supported in any > way to have different threads or goroutines running in different namespaces > within a single Go process. The Go scheduler can move a goroutine

Re: [go-nuts] golang.org/x/text/transform.Chain is not thread safe

2016-06-20 Thread Ian Lance Taylor
On Mon, Jun 20, 2016 at 5:57 PM, Bryan Reynaert wrote: > > the following code panics with: runtime error: slice bounds out of range > > > var testTransform = transform.Chain(norm.NFD, norm.NFC) > > func main() { > for i := 0; i < 200; i++ { > go func() { >

Re: [go-nuts] Fedora and crypto/elliptic.P224

2016-06-20 Thread Ian Lance Taylor
On Mon, Jun 20, 2016 at 6:59 PM, wrote: > > Should there be a note in the documentation that this has been removed by > the Fedora packagers? > > It would help assure developers that they're not insane when they get a > compile error claiming that something that >

Re: [go-nuts] Fedora and crypto/elliptic.P224

2016-06-20 Thread Ian Lance Taylor
On Mon, Jun 20, 2016 at 9:18 PM, wrote: > > Nothing is stopping them, but people aren't going to go to the distribution > docs for the Go standard library - they're going to go to the official docs. It is not sustainable for us to provide distro-specific docs for

Re: [go-nuts] Re: Is there a bug in path.Dir?

2016-06-20 Thread Ian Lance Taylor
On Mon, Jun 20, 2016 at 5:59 PM, <18126523...@163.com> wrote: > Package "filepath" works well, but the "path" package is not recommended ? The path package is for slash-separated packages such as appear in URLs. The path/filepath package is for paths in the file system. Ian > 在 2016年6月20日星期一

Re: [go-nuts] caching of cgo compilation

2016-06-15 Thread Ian Lance Taylor
On Wed, Jun 15, 2016 at 2:54 PM, Alex Flint wrote: > Under what conditions does a cgo package get recompiled? I am using > go-sqlite3 and it appears that the C compiler/linker is run every time I > build my project, even though I am not changing any of the C sources. I >

Re: [go-nuts] Custom syscall.Sockaddr

2016-06-24 Thread Ian Lance Taylor
On Fri, Jun 24, 2016 at 8:05 AM, wrote: > > I am trying to set up an interface from Go to SocketCAN > (https://www.kernel.org/doc/Documentation/networking/can.txt). This > implements the linux socket interface, however it is a completely separate > socket type from the

Re: [go-nuts] Does pprof enabled in production gives a significant impact in performance?

2016-06-23 Thread Ian Lance Taylor
On Thu, Jun 23, 2016 at 12:41 PM, Marcos Oliveira wrote: > > We are to deploy a service in production and there's the question if we > should keep pprof and its HTTP handlers enabled by default in the service or > if we should have a flag that enables them when needed, but

Re: [go-nuts] golang poll/epoll/select

2016-06-27 Thread Ian Lance Taylor
On Mon, Jun 27, 2016 at 6:26 AM, Michael Soulier wrote: > On Saturday, June 25, 2016 at 9:03:59 PM UTC-4, Michael Soulier wrote: >> >> Hmm. Maybe I misunderstand how runsv connects the two. A simple shell test >> seems to behave more as expected. I'll need to dig. >> > > I

Re: [go-nuts] Unused var written in closure

2016-06-26 Thread Ian Lance Taylor
On Sat, Jun 25, 2016 at 12:34 PM, Val wrote: > Hello > It seems that this code doesn't compile : > > func main() { > var err error > err = f() > } > > prog.go:8: err declared and not used > > > but this one does : > > func main() { > var err error > g :=

Re: [go-nuts] Where is .gosymtab in go binaries with cgo?

2016-06-26 Thread Ian Lance Taylor
On Sun, Jun 26, 2016 at 12:18 AM, Tamás Gulácsi wrote: > I want to find out the source package's given the binary. > > github.com/FiloSottile/gorebuild (and github.com/rjeczalik/which) works fine > with binaries built with the "go" tool. > But fails if cgo (and thus I think

Re: [go-nuts] Re: 'go tool pprof' only shows "Type: CPU" and not a callgraph

2016-06-27 Thread Ian Lance Taylor
On Mon, Jun 27, 2016 at 1:52 PM, Kyle Stanly wrote: > I'd also like to mention I did try both 'runtime/pprof' and > github.com/pkg/profile, both yield the same (lack of) results. We can't help you without more information. What kind of system, what version of Go, what sort

Re: [go-nuts] ioutil.WriteFile and Sync

2016-07-22 Thread Ian Lance Taylor
On Fri, Jul 22, 2016 at 3:40 AM, Manlio Perillo wrote: > > I think your reasoning is wrong. > WriteFile is a "self contained" function; it does not return the handle to > the file, so it can not be used inside a transaction. > I really don't see valid reasons to not call

Re: [go-nuts] Is it weird?

2016-07-25 Thread Ian Lance Taylor
On Mon, Jul 25, 2016 at 10:40 AM, Matt Harden wrote: > The syntax is {...}. &42 does not match this syntax. What Jan was > describing is specific to that syntax, not to the use of & in general; in > fact let's try it for : > > tmp := x > > > This gives a very different and

Re: [go-nuts] Why dose reflect.Value.InterfaceData() return [2]uintptr, not (uintptr, uintptr)?

2016-07-14 Thread Ian Lance Taylor
On Thu, Jul 14, 2016 at 7:05 AM, wrote: > http://research.swtch.com/interfaces > > is nice for reflect.Value.InterfaceData() to use (uintptr, uintptr)? > > Why doesn't it use two-value return? I think it's because when Rob added it in 2010 (https://golang.org/cl/2597041)

Re: [go-nuts] getting the receiver from a bound method

2016-07-21 Thread Ian Lance Taylor
On Thu, Jul 21, 2016 at 8:52 PM, Alex Flint wrote: > Is it possible to use reflection to retrieve the value of x from > reflect.ValueOf(x.SomeMethod) where x is an instance of some struct type? No. Approximately the only thing you can do with a reflect.Value that is a

[go-nuts] msan failures in Go 1.7 Release Candidate 6

2016-08-10 Thread Ian Lance Taylor
On Wed, Aug 10, 2016 at 7:00 AM, David Marceau wrote: > when I install from sources straight from git checkout go1.7rc6 > go1.7rc6 FAILS on Asus Z97-A-USB31 motherboard with intel i5-4590, > "../misc/cgo/testsanitizers" > it core dumps and doesn't give me the success

Re: [go-nuts] golang non-availability in Iran...

2016-08-02 Thread Ian Lance Taylor
On Tue, Aug 2, 2016 at 1:37 AM, wrote: > Hi > is golang free to all? > why golang.org is block for Iranian users ?? https://github.com/golang/go/issues/12380 Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] golang non-availability in Iran...

2016-08-02 Thread Ian Lance Taylor
On Tue, Aug 2, 2016 at 8:08 AM, Sam Whited <s...@samwhited.com> wrote: > On Tue, Aug 2, 2016 at 8:43 AM, Ian Lance Taylor <i...@golang.org> wrote: >> On Tue, Aug 2, 2016 at 1:37 AM, <vejdani.sho...@gmail.com> wrote: >>> Hi >>> is golang free to all?

Re: [go-nuts] Why is reflect.ValueOf(nil map).Interface() != nil?

2016-08-09 Thread Ian Lance Taylor
On Tue, Aug 9, 2016 at 9:48 AM, Sam Salisbury wrote: > > The update I suggest is to add the following sentence to the end of the > reflect.Value.IsNil documentation: > >> Likewise, if v was created by calling ValueOf on an initialised >> interface{} value with a nil value

Re: [go-nuts] protobuf go and pointers

2016-08-03 Thread Ian Lance Taylor
On Wed, Aug 3, 2016 at 8:58 AM, Sankar wrote: > > I have a .proto2 file, like: > > message s { > optional double a = 1; > } > > When I run protoc and generate the .pb.go file, it contains code like: > > type S struct { > A*float64

Re: [go-nuts] getting 403 forbidden when I try to access go plaground examples

2016-08-04 Thread Ian Lance Taylor
On Thu, Aug 4, 2016 at 8:52 AM, Michael Bubb wrote: > > Our chief data scientist at work was showing me an example of a prime sieve > in golang. He shared this with me: > > https://play.golang.org/p/49awp0a7jv > > I get a 403 forbidden when I try to access that or any

Re: [go-nuts] runtime.Caller ->

2016-08-14 Thread Ian Lance Taylor
On Sun, Aug 14, 2016 at 11:10 AM, 'Tim Hockin' via golang-nuts wrote: > I was playing with a method that wants to print the file:line of the > caller. `runtime.Caller(1)` seems like it should do the trick, but I > get ':2'. If I call `runtime.Caller(2)` instead it

Re: [go-nuts] Fast ConcurrentCounter without memory sharing

2016-08-14 Thread Ian Lance Taylor
On Sun, Aug 14, 2016 at 2:49 PM, Nigel Tao <nigel...@golang.org> wrote: > On Aug 15, 2016 05:21, "Ian Lance Taylor" <i...@golang.org> wrote: >> If these approaches seem awkward, I suppose you could get >> syscall(syscall.GETCPU, ...) when you want to increment

Re: [go-nuts] keyed vs unkeyed fields

2016-08-12 Thread Ian Lance Taylor
On Fri, Aug 12, 2016 at 2:29 PM, Anmol Sethi wrote: > Keyed fields seem to be always better than unkeyed fields in a composite > literal. > Under what circumstances would I want to use unkeyed fields? Keys aren't always useful, e.g., var colors = [...]string{"red", "blue",

Re: [go-nuts] keyed vs unkeyed fields

2016-08-13 Thread Ian Lance Taylor
On Sat, Aug 13, 2016 at 12:06 AM, Anmol Sethi wrote: > Thing is, since keyed fields are almost always better, why were unkeyed > fields even allowed for struct literals? I see what you mean in your example, > but I think it would be simpler to only have unkeyed fields. > > Was

Re: [go-nuts] compressing long list of short strings

2016-08-10 Thread Ian Lance Taylor
On Wed, Aug 10, 2016 at 3:27 PM, Alex Flint wrote: > > I have long list of short strings that I want to compress, but I want to be > able to decompress an arbitrary string in the list at any time without > decompressing the entire list. > > I know the list ahead of time and

Re: [go-nuts] filepath.Clean

2016-07-13 Thread Ian Lance Taylor
On Wed, Jul 13, 2016 at 10:40 AM, Anmol Sethi wrote: > Why does filepath.Clean replace each slash with a separator at the end of the > function? What’s the point of attempting to clean it if the separator used is > incorrect? Wouldn’t doing this at the start of the function

Re: [go-nuts] Rel in path package

2016-07-12 Thread Ian Lance Taylor
On Tue, Jul 12, 2016 at 5:17 PM, Anmol Sethi wrote: > Why is there no function in the path package to get relative paths, like > filepath.Rel? When would you want to use it? Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] ARM big-endian support roadmap

2016-07-12 Thread Ian Lance Taylor
On Tue, Jul 12, 2016 at 5:20 AM, Igor Gatis wrote: > > AFAIK, big endian support for ARM is not available. Will it ever be > supported? If somebody works on it, and can provide a build machine for testing. See https://github.com/golang/go/wiki/PortingPolicy . > Out of

Re: [go-nuts] How to allocate memory from OS in compatible way.

2016-07-12 Thread Ian Lance Taylor
On Tue, Jul 12, 2016 at 1:05 AM, <sphilip...@gmail.com> wrote: > GCC slow, not GC. Sorry, my apologies for misreading. Ian > вторник, 12 июля 2016 г., 1:52:01 UTC+3 пользователь Ian Lance Taylor > написал: >> >> On Mon, Jul 11, 2016 at 1:25 PM, <sphil

Re: [go-nuts] Proposal: Add coloured output to go commands

2016-07-12 Thread Ian Lance Taylor
On Tue, Jul 12, 2016 at 9:36 PM, Zac Pullar-Strecker wrote: > Commands like go run, go build and go test amoung others should have > coloured output when an error occurs. it would make reading stack traces a > lot easier. I personally use the go run tool a lot during development

Re: [go-nuts] if something not perfect here

2016-07-12 Thread Ian Lance Taylor
On Tue, Jul 12, 2016 at 8:07 PM, wweir9 wrote: > These are two screeshot from os/exec , it looks like that code below will > always be true. > len(c.Args) > 0 > > > >

Re: [go-nuts] exec.Cmd: if the child forks Wait may hang forever

2016-07-13 Thread Ian Lance Taylor
On Wed, Jul 13, 2016 at 1:50 PM, noxiouz wrote: > > I faced a corner case of cmd.Exec usage and want to find out if it's > designed behavior. ... > So I would like to find out if setting cmd.Stdout explicitly is not > expected. Sounds like https://golang.org/issue/13155

Re: [go-nuts] scheduling non determinism

2016-07-17 Thread Ian Lance Taylor
On Sun, Jul 17, 2016 at 9:25 AM, Scott Cotton wrote: > > I'm well aware of the benefits of non-deterministic select for many use > cases, I don't contest that at all or the decision to have it part of > golang. > > A clear and concrete problem is the following: The sat solver

Re: [go-nuts] Re: [security] Go 1.6.3 and 1.7rc2 are released

2016-07-18 Thread Ian Lance Taylor
be migrated from the master branch to the 1.7 branch. Ian > On Monday, July 18, 2016 at 12:31:13 PM UTC-7, Ian Lance Taylor wrote: >> >> On Mon, Jul 18, 2016 at 12:11 PM, <jonathan...@live.com> wrote: >> > Why are the other changes to be released but not related t

Re: [go-nuts] Re: [security] Go 1.6.3 and 1.7rc2 are released

2016-07-18 Thread Ian Lance Taylor
On Mon, Jul 18, 2016 at 4:40 PM, <jonathan.gaill...@live.com> wrote: > Ah, sounds good. By chance is there an estimated date on that? :D Wednesday or Thursday. Ian > On Monday, July 18, 2016 at 2:49:54 PM UTC-7, Ian Lance Taylor wrote: >> >> On Mon, Jul 18, 201

Re: [go-nuts] how to recompile a stdlib package?

2016-07-19 Thread Ian Lance Taylor
On Tue, Jul 19, 2016 at 5:52 AM, roger peppe wrote: > Until not so long ago, if I wanted to (say) insert a log.Printf > somewhere in net/http to see what's going on, I could just > change the net/http code and "go install net/http". > > Since Go 1.5, that no longer seems to be

Re: [go-nuts] Where can I get the documents explaining arguments of "go build" flags?

2016-07-20 Thread Ian Lance Taylor
On Tue, Jul 19, 2016 at 11:54 PM, Dave Cheney wrote: > -gcflags are passed to go tool compile, -ldflags are passed to go tool link. And you can see the docs for those at https://golang.org/cmd/compile and https://golang.org/cmd/link . Ian -- You received this message because

Re: [go-nuts] xorm - 4.3 - panic: gob: registering duplicate names

2016-07-15 Thread Ian Lance Taylor
On Fri, Jul 15, 2016 at 11:39 AM, DM wrote: > I am getting the below exception with xorm - 4.3 and golang 1.4.2. Any idea > what could be going wrong? Is this some known issue xorm - 4.3 or some thing > other going wrong? > > panic: gob: registering duplicate names for

Re: [go-nuts] What dependency management tool do you use?

2016-07-16 Thread Ian Lance Taylor
On Sat, Jul 16, 2016 at 5:29 AM, Henrik Johansson wrote: > For repeatable builds there are many ways and tools that work fine, Gb is > not unique in this respect. > > I don't get why this should be a controversial topic however. It seems to be > an issue only in the go

Re: [go-nuts] How to allocate memory from OS in compatible way.

2016-07-11 Thread Ian Lance Taylor
On Mon, Jul 11, 2016 at 9:11 AM, wrote: > Thank for answer but I'm already implemented portable unmanaged memory pool > (https://github.com/ardente/goal/blob/master/gut/mempool.go). I'm just > looking for standard direct analogue (incliding mapping of fd -1) of unix's >

Re: [go-nuts] http.Handler method name

2016-07-12 Thread Ian Lance Taylor
On Tue, Jul 12, 2016 at 12:10 PM, Anmol Sethi wrote: > Why is http.Handler’s method name ServeHTTP and not Handle? Handle seems to > be more idiomatic. I doubt there is any deep reason. ServeHTTP dates back to when the Handler interface was introduced before the public

Re: [go-nuts] http.Handler method name

2016-07-12 Thread Ian Lance Taylor
On Tue, Jul 12, 2016 at 1:14 PM, Anmol Sethi wrote: > If you were to redesign it now, would you name the method Handle? Speaking personally, I think that either I would name the method Handle, or I would write type HTTPHandler interface { HTTPHandle(...) } -- You

Re: [go-nuts] How to allocate memory from OS in compatible way.

2016-07-11 Thread Ian Lance Taylor
:03:07 UTC+3 пользователь Ian Lance Taylor > написал: >> >> On Mon, Jul 11, 2016 at 9:11 AM, <sphil...@gmail.com> wrote: >> > Thank for answer but I'm already implemented portable unmanaged memory >> > pool >> > (https://github.com/ardente/goal/blob/maste

Re: [go-nuts] confused about string allocation

2016-07-11 Thread Ian Lance Taylor
On Mon, Jul 11, 2016 at 4:40 PM, Erich Rickheit KSC <rickh...@numachi.com> wrote: > Ian Lance Taylor wrote: >> On Sat, Jul 9, 2016 at 4:38 PM, Erich Rickheit KSC <rickh...@numachi.com> >> wrote: >> > I found myself writing code like this: >

Re: [go-nuts] Rel in path package

2016-07-13 Thread Ian Lance Taylor
for things like URLs, and the path/filepath package is for file system paths.) Ian >> On Jul 12, 2016, at 10:58 PM, Ian Lance Taylor <i...@golang.org> wrote: >> >> On Tue, Jul 12, 2016 at 5:17 PM, Anmol Sethi <an...@aubble.com> wrote: >>> Why is there

Re: [go-nuts] Linking C dynamic library non-standard location

2016-07-16 Thread Ian Lance Taylor
On Jul 16, 2016 2:10 PM, <dan...@basereality.com> wrote: > > Hi Ian, > > On Saturday, 16 July 2016 20:05:26 UTC+1, Ian Lance Taylor wrote: >> >> >> I'm suggesting that you need an additional option: -R >> /temp/imagemagick-temp/lib. You need to set t

Re: [go-nuts] How likely is a data race to allow arbitrary code execution?

2016-07-16 Thread Ian Lance Taylor
On Sat, Jul 16, 2016 at 11:36 AM, Demi Obenour wrote: > > One more question: is racing on a map likely to crash due to out-of- > bounds reads, as opposed to out-of-bounds writes? Either is possible. I don't see a reason why one would be more probably than the other. Ian

Re: [go-nuts] Linking C dynamic library non-standard location

2016-07-16 Thread Ian Lance Taylor
On Sat, Jul 16, 2016 at 11:40 AM, <dan...@basereality.com> wrote: > > On Saturday, 16 July 2016 18:08:59 UTC+1, Ian Lance Taylor wrote: > >> >> My guess is that you need to either pass -R /temp/imagemagick-temp/lib >> to the linker, which you can do by setting

Re: [go-nuts] How likely is a data race to allow arbitrary code execution?

2016-07-16 Thread Ian Lance Taylor
On Jul 16, 2016 12:35 PM, "Demi Obenour" <demioben...@gmail.com> wrote: > > On Sat, 2016-07-16 at 12:06 -0700, Ian Lance Taylor wrote: > > On Sat, Jul 16, 2016 at 11:36 AM, Demi Obenour <demioben...@gmail.com > > > wrote: > > > > > > >

Re: [go-nuts] GO on ppc64 platform!

2016-06-28 Thread Ian Lance Taylor
On Tue, Jun 28, 2016 at 1:05 AM, Leno Hou wrote: > I'm facing the problem using go-1.6.2 when building docker on ppc64 > platform. Could anyone help me ? thanks~ This looks to me like problems in the Docker source code. I don't see any problems with the Go standard library,

Re: [go-nuts] Go can't alloc custom objects from byte slice's memory address?

2016-07-09 Thread Ian Lance Taylor
On Fri, Jul 8, 2016 at 10:11 PM, Arthur wrote: > my program allocates many different kinds of small object, and that gives GC > a lot pressure. > so I wan't to make a big slice and split object from it manually. > > block = make([]byte, 30*1024) > myObj :=

Re: [go-nuts] confused about string allocation

2016-07-09 Thread Ian Lance Taylor
On Sat, Jul 9, 2016 at 4:38 PM, Erich Rickheit KSC wrote: > I found myself writing code like this: > > s := make([]byte, len) > for i := 0; i < len; i++ { > // fill in s with stringy goodness > } > return string(s) > > Does

Re: [go-nuts] Go can't alloc custom objects from byte slice's memory address?

2016-07-10 Thread Ian Lance Taylor
memory that you allocate yourself using mmap. As you suggest, this does mean that you must not store pointers to GC allocated objects in the mmap region. Ian > воскресенье, 10 июля 2016 г., 5:07:19 UTC+3 пользователь Ian Lance Taylor > написал: >> >> On Fri, Jul 8, 2016 at 10:

Re: [go-nuts] Strange behaviour of Goroutine with time.Sleep on macOS 10.12

2016-07-10 Thread Ian Lance Taylor
On Sun, Jul 10, 2016 at 7:17 PM, Huy Tr. wrote: > > But when I run it on macOS 10.12 beta 2, the loop stop updating after > running for a while. https://golang.org/issue/16272 It's fixed on tip and will be fixed in 1.7 but all earlier Go releases are broken on 10.12. Ian

Re: [go-nuts] Failure to go build -race with alpine and musl libc (__libc_malloc undefined)

2016-07-11 Thread Ian Lance Taylor
On Mon, Jul 11, 2016 at 6:57 AM, Peter Waller wrote: > Thanks Ian. No luck though, that doesn't seem to be it. > > I have rebuilt the race detector .syso as mentioned in the README. > > I get the same error as before (below, again) while building the > runtime/race package,

Re: [go-nuts] Unused var written in closure

2016-07-04 Thread Ian Lance Taylor
On Sun, Jul 3, 2016 at 11:57 PM, Gordon Klaus wrote: > Ok, so strictly speaking there is no bug. Both gc and gccgo are > spec-compliant; gc just opts not to raise an error in this case. (One might > say it is a bug that gc doesn't raise the error consistently, but I

Re: [go-nuts] Unsure when two interfaces are considered identical

2016-07-04 Thread Ian Lance Taylor
On Mon, Jul 4, 2016 at 8:11 AM, Jon Bodner wrote: > > The issue you pointed at is exactly what I'd like to see. > > In my case, I'm providing an interface that matches what's in database/sql > without creating an explicit dependency on database/sql (for cases when > non-sql

Re: [go-nuts] Initialize Variables in case clause of a switch

2016-08-05 Thread Ian Lance Taylor
On Fri, Aug 5, 2016 at 8:57 AM, dc0d wrote: > In Go we can write: > > if _, ok := input.(*data); ok { > //... > } > > Why is it we can't do that in the case clause of a switch statement: > > switch { > case x1,ok:=input.(*data1); ok && otherCond1: > case

Re: [go-nuts] Why can't interface value be constant?

2016-08-05 Thread Ian Lance Taylor
On Fri, Aug 5, 2016 at 11:21 AM, T L wrote: > > For an interface value, its internal values will never change. > Are there any problems if golang supports constant interface values? Pedantically, in Go, constants are untyped by default. It doesn't make sense to speak of an

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 11:19 AM, Manlio Perillo wrote: > Il giorno giovedì 4 agosto 2016 17:54:33 UTC+2, Dave Cheney ha scritto: >> >> Fwiw, io.EOf can be converted to a constant, all the tests pass. But that >> would change the type of an exported symbol, so it's not

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 10:47 AM, T L <tapir@gmail.com> wrote: > > On Friday, August 5, 2016 at 1:14:38 AM UTC+8, Ian Lance Taylor wrote: >> >> On Thu, Aug 4, 2016 at 10:13 AM, T L <tapi...@gmail.com> wrote: >> > >> > On Thursday, August

Re: [go-nuts] net/http and static binaries

2016-08-08 Thread Ian Lance Taylor
On Sun, Aug 7, 2016 at 7:08 PM, Amit Saha wrote: > > From an old thread [1], I learned that CGO_ENABLED=0 will create static > binaries for programs using the net/http package. I still see the same > behavior as of go version go1.6.3 linux/amd64. Does this mean this is the

Re: [go-nuts] How long are the results from runtime.Callers valid?

2016-08-06 Thread Ian Lance Taylor
On Sat, Aug 6, 2016 at 10:08 AM, Carl Mastrangelo wrote: > TL;DR: Is the uintptr slice returned from runtime.Callers always valid? > > Reading the docs* for runtime.Callers says: "Callers fills the slice pc with > the return program counters of function invocations on

Re: [go-nuts] Why can't interface value be constant?

2016-08-06 Thread Ian Lance Taylor
On Sat, Aug 6, 2016 at 4:08 AM, T L wrote: > > If you carelessly change the value of a global variable in std lib, some > hard found bugs will be created. This is what you really want, and it is the reason I was talking about immutable variables earlier. In Go, a constant

Re: [go-nuts] Is this an acceptable way to handle errors

2016-08-06 Thread Ian Lance Taylor
On Sat, Aug 6, 2016 at 5:50 AM, GoNutter wrote: > > I have a number of cases where I have to handle typed errors. I have been > doing this previoiusly > > err :=SomeFunctionCall() > if err != nil{ > switch e := err.(type){ > case sometype: >//do something >

Re: [go-nuts] Why is reflect.ValueOf(nil map).Interface() != nil?

2016-08-09 Thread Ian Lance Taylor
On Tue, Aug 9, 2016 at 6:23 AM, Sam Salisbury wrote: > > All this gets me thinking, is there any use case where this fact is useful? > (I.e. a nil-valued interface not being equal to nil via the == operator.) This has been discussed several times on the mailing list. An

Re: [go-nuts] CGO export function parameter types in packages

2016-08-02 Thread Ian Lance Taylor
On Tue, Aug 2, 2016 at 8:05 AM, Vladimír Magyar wrote: > > why is that? the MyInt type is just an alias of C.int. or? I didn't look too closely, but I think this is https://golang.org/issue/13467 . Ian -- You received this message because you are subscribed to the

Re: [go-nuts] Crosscompiling LXD for ppc64 (big endian) #16640

2016-08-09 Thread Ian Lance Taylor
On Tue, Aug 9, 2016 at 12:32 PM, Guillermo Cordon wrote: > > 1.) What version of Go are you using (go version)? > > > go version go1.6.3 linux/amd64 > > > 2.)What operating system and processor architecture are you using (go env)? > > > Ubuntu 14.04 with the following

Re: [go-nuts] Error vs. Panic: Should functions like strings.Repeat return an error value?

2016-06-30 Thread Ian Lance Taylor
On Thu, Jun 30, 2016 at 9:17 AM, Michael Whatcott wrote: > The blog post on error handling in go establishes the following guideline: > >> In Go, error handling is important. The language's design and conventions >> encourage you to explicitly check for errors where they

Re: [go-nuts] Re: Relaxing rules on slice comparison: would it make sense?

2016-06-30 Thread Ian Lance Taylor
On Thu, Jun 30, 2016 at 9:24 AM, Chad wrote: > It's a view in another array. > Why should they be equal? Unless the second slice is constructed by > subslicing the other as such `[:]`, the slices are different. > > If I were to access one of the slice backing array and mutate

Re: [go-nuts] Append to slice... what happens?

2016-07-01 Thread Ian Lance Taylor
On Fri, Jul 1, 2016 at 2:42 AM, Martin Geisler <mar...@geisler.net> wrote: > > On Mon, Jun 27, 2016 at 8:18 PM, Ian Lance Taylor <i...@golang.org> wrote: >> On Sun, Jun 26, 2016 at 10:55 PM, Dan Kortschak >> <dan.kortsc...@adelaide.edu.au> wrote: >>&

Re: [go-nuts] Handling dynamic and unknown number of wait groups?

2016-06-29 Thread Ian Lance Taylor
On Wed, Jun 29, 2016 at 9:52 AM, Inspectre Gadget wrote: > Hey everyone, > > Here’s my issue, I will try to keep this short and concise: > > I have written a program that will accept a URL, spider that URL’s domain > and scheme (http/https), and return back all input fields

Re: [go-nuts] GIMP plugins written in pure Go

2016-07-01 Thread Ian Lance Taylor
On Fri, Jul 1, 2016 at 7:37 AM, Sam Whited wrote: > On Thu, Jun 30, 2016 at 10:37 PM, simran wrote: >> I'm wanting to write some image modification stuff and want to plug it into >> GIMP, and being able to look at samples would really help. > > This

Re: [go-nuts] net/smtp Client.hello() returns a single error and drops the ehlo error entirely

2016-07-01 Thread Ian Lance Taylor
On Fri, Jul 1, 2016 at 1:17 PM, 'Matthew Altman' via golang-nuts wrote: > https://github.com/golang/go/blob/master/src/net/smtp/smtp.go#L76-L79 > > This method can make two distinct SMTP calls. First an EHLO and then a HELO. > If the EHLO fails it attempts HELO.

Re: [go-nuts] Re: Append to slice... what happens?

2016-07-03 Thread Ian Lance Taylor
On Sun, Jul 3, 2016 at 4:27 AM, wrote: > Can anyone ELI5 it to me, please ? Why if we remove cap result is different > ? I don't understand that. https://blog.golang.org/slices Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Unused var written in closure

2016-07-03 Thread Ian Lance Taylor
On Sat, Jul 2, 2016 at 2:20 AM, wrote: > More generally, this is https://github.com/golang/go/issues/10989. > > Such ineffectual assignments can be detected using > https://github.com/gordonklaus/ineffassign. > > An analysis showed that only a small fraction of such were

Re: [go-nuts] Unsure when two interfaces are considered identical

2016-07-03 Thread Ian Lance Taylor
On Sun, Jul 3, 2016 at 12:27 PM, Jon Bodner wrote: > > I'm working on a DAO adapter layer helper called Proteus > (https://github.com/jonbodner/proteus), and ran into an interesting quirk in > what Go considers equivalent interfaces. I recreated a simplified version of >

Re: [go-nuts] Meet runtime.typedslicecopy: nosplit stack overflow error when cross platform compiling.

2016-07-03 Thread Ian Lance Taylor
On Sun, Jul 3, 2016 at 8:07 PM, wrote: > Build Env: > > Build tool: GoClipse > Windows(7): > Go Installation: go1.6.2 windows/amd64 > > Under default build environment, every thing goes well. I could find the > .exe file in bin folder. But if I try to build target for

Re: [go-nuts] Re: A proposal for generic in go

2016-07-01 Thread Ian Lance Taylor
On Fri, Jul 1, 2016 at 12:51 PM, wrote: > > Perhaps modify Golang's 2.0 calling convention, that EVERY function must get > upon compilation one extra invisible-to programmer argument that is pointer > that > when said function is generic, points to sizeof(T) storage place .

Re: [go-nuts] runtime.Caller ->

2016-08-15 Thread Ian Lance Taylor
Sun, Aug 14, 2016 at 9:55 PM, Ian Lance Taylor <i...@golang.org> wrote: >> On Sun, Aug 14, 2016 at 9:41 PM, Tim Hockin <thoc...@google.com> wrote: >>> On Sun, Aug 14, 2016 at 8:31 PM, Ian Lance Taylor <i...@golang.org> wrote: >>>> On Sun, Aug 14,

Re: [go-nuts] goroutine 17 [syscall, 214 minutes, locked to thread]

2016-08-15 Thread Ian Lance Taylor
On Mon, Aug 15, 2016 at 1:21 AM, wrote: > > In goroutine stack dump there is a dead lock. > > goroutine 17 [syscall, 214 minutes, locked to thread]: > runtime.goexit() > /root/go/src/runtime/asm_amd64.s:1998 +0x1 > > > No more information, just this. I don't know how to

Re: [go-nuts] runtime.Caller ->

2016-08-15 Thread Ian Lance Taylor
er. Ian > On Mon, Aug 15, 2016 at 10:17 AM, Ian Lance Taylor <i...@golang.org> wrote: >> On Sun, Aug 14, 2016 at 10:07 PM, Tim Hockin <thoc...@google.com> wrote: >>> Can I rely on "" not changing? >> >> I'm sorry, that's a har

Re: [go-nuts] Re: is it possible to speed up type assertion?

2017-02-02 Thread Ian Lance Taylor
On Thu, Feb 2, 2017 at 1:04 PM, Chris Lu wrote: > > I am trying to build a generic distributed map reduce system similar to > Spark. Without generics, the APIs pass data via interface{}. For example, a > reducer is written this way: > > func sum(x, y interface{}) (interface{},

Re: [go-nuts] Is there a reason go doesn't use the small string optomization

2017-01-31 Thread Ian Lance Taylor
On Tue, Jan 31, 2017 at 9:10 PM, Eliot Hedeman wrote: > I was writing up a proposal about adding the small string > optimization(putting strings on the heap if they will fit within the > sringStruct)to the go runtime, and I realized there might be good reason why > this

Re: [go-nuts] Is there a reason go doesn't use the small string optomization

2017-02-01 Thread Ian Lance Taylor
lues to some other function that takes arguments of type `string`, such as `strings.Split` or whatever. At that point the distinction you are talking about is lost. Ian > On Tuesday, January 31, 2017 at 11:15:54 PM UTC-6, Ian Lance Taylor wrote: >> >> On Tue, Jan 31, 2017 at 9:10

Re: [go-nuts] internal compiler error: name too long: *struct {

2017-02-01 Thread Ian Lance Taylor
On Wed, Feb 1, 2017 at 4:58 AM, wrote: > > Go 1.7.1, 1.7.5 does not compile program with a large struct defintion. > Version 1.6.4 and some other previous versions do compile. > It could be a problem of the 1.7 compiler. > > The declaration of the struct type is

Re: [go-nuts] Request for very simple cgo example to check compiler environment

2017-02-01 Thread Ian Lance Taylor
On Wed, Feb 1, 2017 at 6:57 AM, Arie van Wingerden wrote: > In another thread I asked for help with Mingw64. > Following Andrew Gerrands advice I now have installed TDM-GCC-64. > > Still I get errors when compiling a quite big project of someone else. But I > am not sure

Re: [go-nuts] Is there a reason go doesn't use the small string optomization

2017-02-01 Thread Ian Lance Taylor
2017, 06:15 Ian Lance Taylor <i...@golang.org> wrote: >> >> On Tue, Jan 31, 2017 at 9:10 PM, Eliot Hedeman >> <eliot.d.hede...@gmail.com> wrote: >> > I was writing up a proposal about adding the small string >> > optimization(putting strings on the

Re: [go-nuts] Is there a reason go doesn't use the small string optomization

2017-02-01 Thread Ian Lance Taylor
On Wed, Feb 1, 2017 at 6:35 AM, Ian Lance Taylor <i...@golang.org> wrote: > On Tue, Jan 31, 2017 at 10:26 PM, <landi...@gmail.com> wrote: >> It would know at string creation time because strings in go are immutable. >> Really these are two types, with duck typing be

Re: [go-nuts] About 64bits alignment

2017-02-04 Thread Ian Lance Taylor
On Sat, Feb 4, 2017 at 7:33 AM, Axel Wagner wrote: > > I believe, that fields do not necessarily need to be properly aligned > (explaining 599). However, *structs* have a necessary alignment, as required > by their fields. So, if you do > type S struct { > A

Re: [go-nuts] About 64bits alignment

2017-02-04 Thread Ian Lance Taylor
On Sat, Feb 4, 2017 at 2:38 PM, Axel Wagner <axel.wagner...@googlemail.com> wrote: > On Sat, Feb 4, 2017 at 11:13 PM, Ian Lance Taylor <i...@golang.org> wrote: >> >> The spec does not say that unsafe.Alignof(s.B) will return 8. In >> fact, on 32-bit targets, with

Re: [go-nuts] Re: troubleshooting 100% cpu peg - runtime._ExternalCode ?

2017-02-07 Thread Ian Lance Taylor
On Mon, Feb 6, 2017 at 9:53 PM, Jason E. Aten wrote: > > On Monday, February 6, 2017 at 11:49:42 PM UTC-6, Dave Cheney wrote: >> >> The give away is the frequency of the gc lines. gc 15 (the 15th gc event) >> happened at 1314 seconds into your programs execution this tells me

  1   2   3   4   5   6   7   8   9   10   >