id
int64 393k
2.82B
| repo
stringclasses 68
values | title
stringlengths 1
936
| body
stringlengths 0
256k
⌀ | labels
stringlengths 2
508
| priority
stringclasses 3
values | severity
stringclasses 3
values |
---|---|---|---|---|---|---|
51,281,862 | go | cmd/compile: eliminate duplicate instrumentation in racewalk | <pre>Use simple analysis to eliminate duplicate instrumentation in cases like:
x = ...;
... = x;
Currently it leads to insertion of 2 raceread() calls.</pre>
| Performance,RaceDetector | low | Minor |
51,281,931 | go | crypto/aes: add assembly for non-AES-NI machines | <pre>golang https server described in <a href="https://golang.org/issue/4073?c=8">https://golang.org/issue/4073?c=8</a>
and tested with
siege --benchmark --concurrent=100 "<a href="https://localhost:8082"">https://localhost:8082"</a>;
command gives
Lifting the server siege... done.
Transactions: 779 hits
Availability: 100.00 %
Elapsed time: 40.56 secs
Data transferred: 0.02 MB
Response time: 4.85 secs
Transaction rate: 19.21 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 93.11
Successful transactions: 779
Failed transactions: 0
Longest transaction: 10.22
Shortest transaction: 0.34
But nginx does better:
Transactions: 5120 hits
Availability: 100.00 %
Elapsed time: 53.87 secs
Data transferred: 0.74 MB
Response time: 1.04 secs
Transaction rate: 95.04 trans/sec
Throughput: 0.01 MB/sec
Concurrency: 98.92
Successful transactions: 5120
Failed transactions: 0
Longest transaction: 1.08
Shortest transaction: 0.15
hg id is 8e87cb8dca7d. windows/386.
linux/386 golang server does about the same:
Lifting the server siege... done.
Transactions: 1867 hits
Availability: 100.00 %
Elapsed time: 118.75 secs
Data transferred: 0.05 MB
Response time: 6.23 secs
Transaction rate: 15.72 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 97.89
Successful transactions: 1867
Failed transactions: 0
Longest transaction: 13.59
Shortest transaction: 0.32
<a href="https://golang.org/issue/4073?c=6">https://golang.org/issue/4073?c=6</a> claims similar results comparing to
"hello world node.js app".
I would investigate more, but I know nothing about SSL.
Alex</pre>
| Performance,NeedsInvestigation | medium | Critical |
51,281,959 | go | syscall: package is underdocumented | by **[email protected]**:
<pre>The standard library syscall package is underdocumented. I was trying to figure how to
write my own utimensat (unimplemented) and I was having a very hard time. What is more,
reading the source of the package doesn't really help, as its code is supposed to be
going through mksyscall.
What I would like to see:
1. An example of writing an unimplemented syscall.
2. How to pass arguments to syscalls (eg. strings should be pointers to nul terminated
byte sequences.
3. Information how to get the right uintptr (reflect or unsafe, when to use each of
them).
4. Documentation any types introduced.
5. A little bit of background information about syscalls would be nice, but that's not
strictly necessary.</pre>
| Documentation,NeedsInvestigation | low | Major |
51,281,992 | go | image/jpeg: correct for EXIF orientation? | <pre>JPEG files can embed EXIF metadata specifying one of 8 mirroring+rotation options. Only
2-3 of these are in common use, from people holding their phones sideways when taking
pictures.
It would be nice of the image/jpeg package could, perhaps optionally, correct for these.
Camlistore will be doing it on its own, but it seems like something the image/jpeg
package is in a good position to do automatically.
It's probably only safe to do the left-90 and right-90 ones automatically (and only when
width & height change), so users can detect whether the operation has already been
done and not apply the transformation again, as orientation-fixing code has to do anyway
(because you can't trust whether upstream software in the wild fixed the metadata for
you when it flipped-and-resaved the image, so you also have to check the before &
after dimensions).
If we want to do this in image/jpeg, I've attached a screenshot of the 8 modes and a
tarball of 16 JPEG files: 1 for each mode without EXIF, and 1 for each mode with the
Orientation field set to "fix" the image back to a lowercase eff letter. The
f files are written on 8x8 pixel boundaries, so we can do pixel-wise compares in tests
safely.</pre>
Attachments:
1. <a href="https://storage.googleapis.com/go-attachment/4341/0/exif-orientations.png">exif-orientations.png</a> (22969 bytes)
2. <a href="https://storage.googleapis.com/go-attachment/4341/0/f.tar">f.tar</a> (30720 bytes)
| Thinking | medium | Critical |
51,282,313 | go | cmd/compile: possible error message improvement | <pre><a href="http://play.golang.org/p/87zosrj611">http://play.golang.org/p/87zosrj611</a>
package main
var x = 10
var y = 0.9 * x
prog.go:4: constant 0.9 truncated to integer
If you don't know that x is an int or that * requires both sides to have the same type,
this is a bit of a leap.
constant 0.9 truncated during conversion to type int (to match x)
might be a little better.</pre>
| NeedsInvestigation | low | Critical |
51,282,314 | go | cmd/compile: which errors are confusing? | <pre>It would be fascinating to take each of the yyerror statements in cmd/gc and plug it
into a google search to find mailing list threads about the errors. How are they
misinterpreted? What could be clearer?</pre>
| Suggested | low | Critical |
51,282,442 | go | x/pkgsite: switch to use html/template | <pre>Godoc should use the auto-escaping htm/template package instead of text/template, for
security reasons.
With text/template, it is hard to write UI code that doesn't introduce content injection
vulnerabilities.</pre>
| Security,pkgsite | low | Major |
51,282,447 | go | doc/tour: write more tours | by **[email protected]**:
<pre>The go lang tour expects coding experience in a previous language, with comments like
"type does what you would expect"
I think for someone with little to no previous coding experience the tour would be next
to impossible to finish. There are also a lot of examples with complex mathematical
operations, such as re-writing sqrt and Fibonacci for experienced programmers this would
be fine, but If I was trying to get a member of my family to go through the tour they
would probably leave at that point.</pre>
| Documentation,NeedsInvestigation | low | Major |
51,282,499 | go | cmd/compile: error message for bad case in switch should suggest select | <pre>When writing a switch statement like this:
package main
func main() {
ch := make(chan int)
switch {
case <-ch:
default:
}
}
The compiler error is:
prog.go:6: invalid case <-ch in switch (mismatched types int and bool)
This is a correct message, but for cases where the user is doing channel operations in
the cases, can we add to the parenthetical "; did you mean select?" ? It
shouldn't be displayed if the type of the channel expression is bool, obviously.</pre>
| Thinking | low | Critical |
51,282,548 | go | text/template: Allow func to take region as final argument | <pre>I would like to extend Go templates to allow funcs to accept a region as an argument.
This is useful any time you want to process or transform a section of text.
For example, I would like to write a func that performs syntax highlighting
(server-side, while all existing solutions are in javascript):
{{/* A sample template */}}
...
A description of my ExampleFunc function and an example of its usage:
{{prettify "go"}}
func ExampleFunc() {
...
}
{{end}}
For that, I would like to use a template func with a signature like:
"prettify": func(lang, body string) template.HTML
The value of the parameter is the region, already executed. This is necessary to allow
usage of template functionality within the region:
{{prettify "go"}}
{{range .examples}}
func Example1() {
{{.}}
}
{{end}}
{{end}}
The func may be called using the current convention, e.g. {{prettify "go"
"func x()"}}, but the template system allows any func with a final argument of
type "string" to use the region form.</pre>
| Thinking,FeatureRequest | low | Major |
51,282,586 | go | cmd/compile: omit zeroing of named return value when possible | <pre>In the program below, f1 and f2 should ideally generate the same code: if a return
variable name is never mentioned in the function and there are no returns without
arguments and no defer statements, the variable need not be cleared on entry:
g% cat x.go
package main
type T [16]int
func f1() (t T) {
return g()
}
func f2() T {
return g()
}
func g() T
g% go tool 6g -S x.go
--- prog list "f1" ---
0000 (x.go:5) TEXT f1+0(SB),$256-128
0001 (x.go:5) LEAQ t+0(FP),DI
0002 (x.go:5) MOVQ $0,AX
0003 (x.go:5) MOVQ $16,CX
0004 (x.go:5) REP ,
0005 (x.go:5) STOSQ ,
0006 (x.go:6) CALL ,g+0(SB)
0007 (x.go:6) LEAQ (SP),BX
0008 (x.go:6) LEAQ autotmp_0000+-128(SP),BP
0009 (x.go:6) MOVQ BP,DI
0010 (x.go:6) MOVQ BX,SI
0011 (x.go:6) MOVQ $16,CX
0012 (x.go:6) REP ,
0013 (x.go:6) MOVSQ ,
0014 (x.go:6) LEAQ autotmp_0000+-128(SP),BX
0015 (x.go:6) LEAQ t+0(FP),BP
0016 (x.go:6) MOVQ BP,DI
0017 (x.go:6) MOVQ BX,SI
0018 (x.go:6) MOVQ $16,CX
0019 (x.go:6) REP ,
0020 (x.go:6) MOVSQ ,
0021 (x.go:6) RET ,
--- prog list "f2" ---
0022 (x.go:9) TEXT f2+0(SB),$256-128
0023 (x.go:10) CALL ,g+0(SB)
0024 (x.go:10) LEAQ (SP),BX
0025 (x.go:10) LEAQ autotmp_0001+-128(SP),BP
0026 (x.go:10) MOVQ BP,DI
0027 (x.go:10) MOVQ BX,SI
0028 (x.go:10) MOVQ $16,CX
0029 (x.go:10) REP ,
0030 (x.go:10) MOVSQ ,
0031 (x.go:10) LEAQ autotmp_0001+-128(SP),BX
0032 (x.go:10) LEAQ .noname+0(FP),BP
0033 (x.go:10) MOVQ BP,DI
0034 (x.go:10) MOVQ BX,SI
0035 (x.go:10) MOVQ $16,CX
0036 (x.go:10) REP ,
0037 (x.go:10) MOVSQ ,
0038 (x.go:10) RET ,
--- prog list "init" ---
0039 (x.go:13) TEXT init+0(SB),$0-0
0040 (x.go:13) MOVBQZX initdone·+0(SB),AX
0041 (x.go:13) CMPB AX,$0
0042 (x.go:13) JEQ ,48
0043 (x.go:13) CMPB AX,$2
0044 (x.go:13) JNE ,46
0045 (x.go:13) RET ,
0046 (x.go:13) CALL ,runtime.throwinit+0(SB)
0047 (x.go:13) UNDEF ,
0048 (x.go:13) MOVB $2,initdone·+0(SB)
0049 (x.go:13) RET ,
g%</pre>
| NeedsInvestigation | low | Major |
51,282,600 | go | cmd/go: go get broken for bzr with no-tree repos | by **bigjools**:
<pre>What steps will reproduce the problem?
1. Set up no-tree repos, or,
in bazaar.conf, set up an alias: "branch = branch --no-tree"
3. "go get launchpad.net/juju-core/..."
What is the expected output?
A valid working tree.
What do you see instead?
go get fails because my package tree is not checked out of the repo:
$ go get -v launchpad.net/juju-core/...
launchpad.net/juju-core (download)
# cd /home/ed/canonical/Go/src/launchpad.net/juju-core; bzr update -r revno:-1
bzr: ERROR: No WorkingTree exists for
"file:///home/ed/canonical/Go/src/launchpad.net/juju-core/.bzr/checkout/".
package launchpad.net/juju-core/...: exit status 3
Which compiler are you using (5g, 6g, 8g, gccgo)?
How do I find out?
Which operating system are you using?
Ubuntu 12.10
Which version are you using? (run 'go version')
go1.0.2
Please provide any additional information below.</pre>
| ExpertNeeded,Suggested | low | Critical |
51,282,601 | go | cmd/compile: init loop does not trace through inlined functions | <pre>$ cat x.go
package p
var x = f
func f() { g() }
func g() { _ = x }
$ 6g x.go
x.go:2: initialization loop:
x.go:2 x refers to
x.go:3 f refers to
x.go:2 x
Should be f refers to g refers to x (but g has been inlined into f and been dropped).</pre>
| NeedsInvestigation | low | Major |
51,282,673 | go | go/printer: unhappy formatting of const declaration | <pre>in go/parser/interface.go:
const (
PackageClauseOnly Mode = 1 << iota // parsing stops after package clause
ImportsOnly // parsing stops after import declarations
ParseComments // parse comments and add them to AST
Trace // print a trace of parsed productions
DeclarationErrors // report declaration errors
SpuriousErrors // same as AllErrors, for backward-compatibility
AllErrors = SpuriousErrors // report all (not just the first 10) errors per file
)
One would expect the "=" to line up. The algorithm for that layout has been
tweaked many times, though. Revisit at some point.</pre>
| NeedsInvestigation | low | Critical |
51,282,696 | go | compress/bzip2: implement bz2 encoder | by **johnkgallagher**:
<pre>All the other compress/* packages include both decompression and compression.
compress/bzip2 only supports decompression.</pre>
| FeatureRequest | medium | Critical |
51,282,784 | go | go/build: should package be aware of GOBIN? | <pre>When using build.Import("GOPATH/src/myCmd", "", 0) a *Package is
returned that has the field BinDir set to be GOPATH/bin.
Package.BinDir is documented as "command install directory".
However: cmd/go states "If the GOBIN environment variable is set, commands are
installed to the directory it names instead of DIR/bin."
(<a href="http://golang.org/cmd/go/#hdr-GOPATH_environment_variable)">http://golang.org/cmd/go/#hdr-GOPATH_environment_variable)</a>
Is it up to pkg/go/build to check for the existence of GOBIN? Or should a user
implementation check for GOBIN?
Example of a fix:
<a href="https://github.com/GeertJohan/rerun/commit/b3bf4d74391a31fb9d313b07535388a47c3eae87">https://github.com/GeertJohan/rerun/commit/b3bf4d74391a31fb9d313b07535388a47c3eae87</a>
pkg/go/build source code concerning the *Package BinDir field:
<a href="http://code.google.com/p/go/source/browse/src/pkg/go/build/build.go#521">http://code.google.com/p/go/source/browse/src/pkg/go/build/build.go#521</a></pre>
| NeedsInvestigation | low | Major |
51,282,964 | go | cmd/asm: MOVL $x-8(SP) and LEAL x-8(SP) are different | <pre>MOVL $x-8(SP), AX assembles to raw LEAL -8(SP), AX.
LEAL x-8(SP), AX assembles to raw LEAL (framesize-8)(SP), AX.
It's a bit confusing that they have different interpretations of x-8(SP).
Same for MOVQ on 6a.
Can wait until after Go 1 because I think I'm the only one who ever uses that form
instead of writing LEAL/LEAQ.</pre>
| NeedsInvestigation | low | Major |
51,283,032 | go | cmd/go: reorganize documentation | <pre>The documentation for the go command appears in doc.go and then again in various files,
plus appendices in package testing and package go/build. It's unwieldy to maintain and
hard for users to think of where to look for each question. It would be nice to tidy
this up at some point.</pre>
| Documentation,NeedsFix,GoCommand | low | Major |
51,283,046 | go | image/gif: decoding untrusted (very large) images can cause huge memory allocations | by **jeff.allen**:
<pre>What steps will reproduce the problem?
1. decode attached gif, get bad behavior due to giant malloc followed by giant memset(0).
2. finally get error about UnexpectedEOF because there is not as much pixel data as the
bounds say there should be.
The problem is that the gif has a frame in it that would need 4.2e9 bytes to hold
according to bounding box, but it only has 1 byte. The allocation of the 4.2e9 bytes
succeeds, but at considerable pain. Then the UnexpectedEOF is thrown.
What is the expected output?
Getting the error without allocating a huge amount of memory first.
What do you see instead?
Long pause and unresponsive computer due to giant memory allocation.
Which compiler are you using (5g, 6g, 8g, gccgo)?
6g
Which operating system are you using?
linux
Which version are you using? (run 'go version')
tip</pre>
Attachments:
1. <a href="https://storage.googleapis.com/go-attachment/5050/0/bug525326.gif">bug525326.gif</a> (11606 bytes)
| Thinking | medium | Critical |
51,283,059 | go | x/pkgsite/internal/fetch/dochtml: BUG, TODO etc. should be re-thought | <pre>Godoc needs updated rules and a nice UI for interpreting and presenting BUG(foo),
TODO(bar) etc. The current setup is odd: it treats things internal to functions
specially, while things at top level are too loosely bound. For instance,
// Foo bars blatz.
// BUG(gopher): Foo should bing bang bam.
func Foo() { }
will fold the TODO onto the previous line, while
// BUG(gopher): Foo should bing bang bam.
// Foo bars blatz.
func Foo() { }
will print the BUG for every query of the package. This is far from intuitive or helpful.</pre>
| Documentation,NeedsInvestigation,pkgsite,UX | low | Critical |
51,283,134 | go | cmd/link: use more standard calling convention on arm | <pre>Unlike the 386 and amd64, arm stores the return address in the word at the top of the
stack rather than in the word below the incoming parameter area.
This is a deviation from the native arm calling convention which also stores the return
address below the incoming parameter area.
Following the native convention would make it easier and less error prone to translate
runtime code between all the supported targets.
The documentation for the native calling convention can be found at following address
<a href="http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042e/IHI0042E_aapcs.pdf">http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042e/IHI0042E_aapcs.pdf</a></pre>
| NeedsInvestigation | medium | Critical |
51,283,162 | go | cmd/gofmt: reformats block comments | by **[email protected]**:
<pre>What steps will reproduce the problem?
Use /* */ for block comments. Example:
func f() {
/*
* don't do this right now
fmt.Printf(`a
multi-line
string`)
*/
return
}
Gofmt alters the content of the comment (which includes the /* and */). The first time
gofmt is called it produces:
func f() {
/*
* don't do this right now
fmt.Printf(`a
multi-line
string`)
*/
return
}
and if called again it produces:
func f() {
/*
* don't do this right now
fmt.Printf(`a
multi-line
string`)
*/
return
}
gofmt should not have altered the comment in the first place. The /* was indented
correctly up front.</pre>
| Thinking | medium | Critical |
51,283,164 | go | cmd/compile: more clever syntax error reporting | <pre>Using the go 1.0.3 compiler, the code at <a href="http://play.golang.org/p/mSSyjMd_MU">http://play.golang.org/p/mSSyjMd_MU</a> gives a
syntax error on line 15 that there is an unexpected ), while the actual error is that
there is a missing } on line 10. In this specific case, hypothetically the compiler
could realize the error is before line 15, because there are two return statements (line
10 and 12) otherwise.
I imagine finding the "true" location of the syntax error in the general case
is hard to do, but I figured I would document the behavior in case something could be
done.</pre>
| NeedsInvestigation | low | Critical |
51,283,189 | go | cmd/compile: too many errors stops too early -- check other related errors | <pre>I'm in the middle of debugging a package which is full of a bunch of code I wrote
quickly. At present, the package consists of three files
<a href="http://play.golang.org/p/XgNpoFpwcp">http://play.golang.org/p/XgNpoFpwcp</a> filename fluidtensors.go
<a href="http://play.golang.org/p/p9897ak11y">http://play.golang.org/p/p9897ak11y</a> filename threedtensor.go
<a href="http://play.golang.org/p/8QrkK-IzCp">http://play.golang.org/p/8QrkK-IzCp</a> filename computations.go
when I run gc (version 1.0.3), I get the following output
brendan:~/Documents/mygo$ go build ransuq/tensor
# ransuq/tensor
src/ransuq/tensor/computations.go:9: re.SymTensor.Dim() used as value
src/ransuq/tensor/computations.go:10: re.SymTensor.Dim() used as value
src/ransuq/tensor/computations.go:11: re.SymTensor.Dim() used as value
src/ransuq/tensor/computations.go:13: re.SymTensor.Dim() used as value
src/ransuq/tensor/computations.go:25: tau.SymTensor.Dim() used as value
src/ransuq/tensor/computations.go:26: tau.SymTensor.Dim() used as value
src/ransuq/tensor/computations.go:27: tau.SymTensor.Dim() used as value
src/ransuq/tensor/computations.go:29: tau.SymTensor.Dim() used as value
src/ransuq/tensor/computations.go:41: tau.SymTensor.Dim() used as value
src/ransuq/tensor/computations.go:53: tau.SymTensor.Dim() used as value
src/ransuq/tensor/computations.go:53: too many errors
re.SymTensor.Dim() being used as a value is not a problem. The problem is that the Dim()
method of SymTensor (in threedtensor.go) is incorrectly returning a value. Relevant code
segment:
func (s *SymTensor) Dim() {
return t.nDim
}
In the ideal case, the compiler would check that the full method of SymTensor is correct
before throwing the error about Dim() being used as a value. Barring that, it would be
nice if the compiler would output some other errors not of that form. The code is
computations is not logically incorrect, it's the code is threedtensor that's incorrect,
and so having this as the only output error is confusing.</pre>
| NeedsInvestigation | low | Critical |
51,283,196 | go | runtime: consider caching previous map hash value | <pre>Michael Jones notes that the following pattern is common in Go code:
if v, ok := map[key]; ok { // or !ok
....
map[key] = newValue
}
If hashing that key type is expensive (say: large string/struct) and the map isn't empty
or very small, the above code does it twice.
If we kept a per-P cache of the last key & last computed hash value for that P, we
could eliminate some hash calls.
Probably worth measuring. (Probably not for Go 1.1)</pre>
| Performance | medium | Critical |
51,283,217 | go | encoding/json: use the Error method to marshal an error value? | <pre>What steps will reproduce the problem?
<a href="http://play.golang.org/p/epXpwk0s4s">http://play.golang.org/p/epXpwk0s4s</a>
What is the expected output?
Something like this:
<a href="http://play.golang.org/p/Dk0l6fTj01">http://play.golang.org/p/Dk0l6fTj01</a>
What do you see instead?
{"bar":{},"foo":{}}
Which compiler are you using (5g, 6g, 8g, gccgo)?
Which operating system are you using?
Linux (Ubuntu 12.04, 3.2.0-38-generic)
Which version are you using? (run 'go version')
go version go1.0.3
go version devel +5260abd6df41 Sat Mar 30 19:05:00 2013 +0800 linux/amd64
Please provide any additional information below.
I think it's not intuitive behaviour. fmt prints errors without problems, why json not?</pre>
| Thinking,v2 | medium | Critical |
51,283,229 | go | proposal: database/sql: support a way to perform bulk actions | <pre>The current implementation of database/sql doesn't provide a way to insert multiple rows
at once, without getting to the wire upon every call to
db.Exec
There are APIs outside which either provide a general way for bulk actions
cf. SQLBulkCopy of ADO.NET 2.0 [1]
or has a specifier upto how many statements should be grouped together
cf. Batch Update of ADO.NET 2.0 DataAdapter Object [1]
or simply supports an array to be bound to Exec, open which Exec iterates internally,
preventing execessive wire communication. [2]
[1] Codeproject, "Multiple Ways to do Multiple Inserts"
<a href="http://www.codeproject.com/Articles/25457/Multiple-Ways-to-do-Multiple-Inserts">http://www.codeproject.com/Articles/25457/Multiple-Ways-to-do-Multiple-Inserts</a>
[2] Python PEP 249 -- Python Database API Specification v2.0
<a href="http://www.python.org/dev/peps/pep-0249/#executemany">http://www.python.org/dev/peps/pep-0249/#executemany</a></pre>
| help wanted,Proposal,FeatureRequest | medium | Critical |
51,283,301 | go | cmd/link: support gdb debugging when hostlinking | <pre>When linking with the host linker, the .debug_gdb_scripts symbol isn't emitted, causing
the gdb python script to not be loaded.
It appears that this isn't the only problem since manually loading the script throws the
following error:
Loading Go Runtime support.
Traceback (most recent call last):
File "../go/src/pkg/runtime/runtime-gdb.py", line 198, in <module>
_rctp_type = gdb.lookup_type("struct runtime.rtype").pointer()
gdb.error: No struct type named runtime.rtype.</pre>
| NeedsInvestigation | medium | Critical |
51,283,359 | go | cmd/cgo: -godefs doesn't handle embedded struct fields correctly | by **[email protected]**:
<pre>Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:
Run "go version" and compare against
<a href="http://golang.org/doc/devel/release.html">http://golang.org/doc/devel/release.html</a> If a newer version of Go exists,
install it and retry what you did to reproduce the problem.
Thanks.
What steps will reproduce the problem?
This struct...
//<libdrm/drm.h>
struct drm_stats {
unsigned long count;
struct {
unsigned long value;
enum drm_stat_type type;
} data[15];
};
When wrapped with cgo as
`
Stats C.struct_drm_stats
`
gets converted by godefs to
`
type Stats struct {
Count uint64
Data [15]_Ctype_struct___0
}
`
What is the expected output?
type Stats struct {
Count uint64
Data [15]struct{
Value uint64 //or uint32
Type uint32
}
}
Which compiler are you using (5g, 6g, 8g, gccgo)?
6g
Which operating system are you using?
archlinux x86-64
Which version are you using? (run 'go version')
go version devel +4a712e80e9b1 Tue Apr 09 15:00:21 2013 -0700 linux/amd64
Please provide any additional information below.
<a href="https://github.com/mortdeus/egles/tree/master/drm">https://github.com/mortdeus/egles/tree/master/drm</a></pre>
| NeedsInvestigation | medium | Critical |
51,283,363 | go | cmd/cgo: godefs shouldnt try to guess which struct field's identifier prefixes preceding `_` is okay to strip. | by **[email protected]**:
<pre>Godef may produce structs with multiple declarations of the same field identifiers if
its allowed to automatically strip the prefix of a C struct's field identifier. For
example,
When this C struct
struct drm_drawable_info {
unsigned int num_rects;
struct drm_clip_rect *rects;
};
is run through godefs it produces the following Go struct.
DrawableInfo struct {
Rects uint32
Pad_cgo_0 [4]byte
Rects *ClipRect
}
Which obviously isnt correct.
The problem with this approach is...
A. I have to open the C source code to find out what the old identifier name used to be.
B. Obviously the tool isnt smart enough to know what prefixes are okay and which should
be stripped.
C. This kind of "magic" implicit functionality is much better implemented as
explicit command line flag with the developer in control.</pre>
| NeedsInvestigation | low | Major |
51,283,396 | go | cmd/go: print shell commands safely | <pre>The printing of commands by the go tool is simple-minded, can be incorrect in the face
of empty strings and other issues, ignores system-dependent issues ($foo vs %foo;
quoting, etc.) and should be improved. The current setup just calls Printf or special
formatting routines that sometimes (not always) expand variables, and ignore local
quoting and other conventions (rm vs. del for example). It's not important but it is
worth doing right.
It's a big job.</pre>
| NeedsInvestigation | low | Major |
51,283,412 | go | spec: Clarify semantics of interface to interface assignment | <pre>When assigning an interface to an interface, the dynamic value of the LHS becomes the
dynamic value of the RHS, but this is not stated anywhere in the spec.
This came up in a discussion I had with a developer who was confused because he could
not use the reflect package to find the method set of an interface. He believed that the
interface{} parameter of reflect.TypeOf should have contained the static type of his
typed nil interface.</pre>
| Documentation,NeedsFix | low | Major |
51,283,441 | go | runtime: detect zombie goroutines | <pre>Runtime can detect goroutines blocked on unreachable chans/mutexes/etc and report such
cases.
This needs an interface in http/pprof to query zombie goroutines on running services.
And probably testing package integration to test for absence of zombie goroutines.</pre>
| NeedsDecision,FeatureRequest | low | Major |
51,283,489 | go | net: cgoLookupIPCNAME doesn't try again for temporary failures in getaddrinfo() | <pre>go version devel +55f0ec9b3c00 Mon Apr 22 22:09:11 2013 -0700 linux/amd64
Heavy usage of net.Dial via net/http.Get gives errors stringifying as " Temporary
failure in name resolution" which corresponds to EAI_AGAIN returned from
getaddrinfo().
I expect net.Dial to retry on this error code.
I'm using 6g on Linux.
No effort is made to set the IsTimeout member of DNSError at the callsite
<a href="http://code.google.com/p/go/source/browse/src/pkg/net/cgo_unix.go#98">http://code.google.com/p/go/source/browse/src/pkg/net/cgo_unix.go#98</a>, and an appropriate
IsTemporary variable is not available.</pre>
| NeedsInvestigation | low | Critical |
51,283,509 | go | go/printer: think about format for chained calls | by **[email protected]**:
<pre>var ss = s.NewConfig().
User("t").
DataLayout(
sssssss.NewDataLayout().
BaseDir("/c").
StartDate("2013-01-01").
Sh(
s.PN{
P: 1,
N: 10}).
H(7).
Hon(0.01))</pre>
| Thinking | low | Major |
51,283,525 | go | runtime/race: instrument Sendmsg/Recvmsg and Flock | <pre>What steps will reproduce the problem?
write a program that synchronizes due to calls to Sendmsg and Recvmsg
build and test with -race
What do you see instead?
a race is detected
Which compiler are you using (5g, 6g, 8g, gccgo)?
6g
Which operating system are you using?
linux
Which version are you using? (run 'go version')
tip
Please provide any additional information below.
Dmitry helped me debug this. Recvmsg needs:
if rsa.Addr.Family != AF_UNSPEC {
from, err = anyToSockaddr(&rsa)
}
+ if raceenabled && err == nil {
+ raceAcquire(unsafe.Pointer(&ioSync))
+ }
Sendmsg needs:
msg.Iov = &iov
msg.Iovlen = 1
+ if raceenabled {
+ raceReleaseMerge(unsafe.Pointer(&ioSync))
+ }
Dmitry suggested that this is for after Go 1.1. Since it's a small fix, it would be nice
to do it before, but we can wait.</pre>
| RaceDetector | low | Critical |
51,283,532 | go | cmd/compile: avoid closure for captured dynamic constant | <pre>The compiler is not very smart about compiling away closures. The following function
needlessly allocates a closure at runtime
func main() {
s := ""
f := func () { println(s) }
g(f)
}
This example should succumb to closure analysis. The closure should be eliminated at
compile time and replaced by an ordinary function.</pre>
| NeedsInvestigation | low | Major |
51,283,541 | go | proposal: spec: byte view: type that can represent a []byte or string | <pre>Go has no built-in type which can represent a read-only view of possibly-changing bytes.
We have two current types which internally are a byte pointer and a length: (the first
also has a capacity, irrelevant to this issue)
[]byte
Allowance: "you can mess with this memory"
Restriction: "this memory isn't necessarily forever; anybody else might be changing it now (race) or later (iterator becoming invalidated after this call, etc)"
string
Allowance: "if you have a reference to this, it's good forever, and nobody will ever mess with it".
Restriction: "you can NOT change"
And because of their conflicting allowances and restrictions, any conversion from
string->[]byte or []byte->string necessarily has to make a copy and often
generates garbage.
Both are great, but there's a missing piece:
Many places in Go's API want a type with *neither* of those allowances, and are happy
with both of those restrictions:
-- much of pkg strings
-- much of pkg bytes
-- all the strconv.Parse* functions (<a href="https://golang.org/issue/2632">issue #2632</a>)
-- most of the string arguments to system calls
-- the io.Writer interface's argument (no need then for io.WriteString)
-- leveldb's Key/Value accessors.
Look at leveldb's Iterator:
<a href="http://godoc.org/code.google.com/p/leveldb-go/leveldb/db#Iterator">http://godoc.org/code.google.com/p/leveldb-go/leveldb/db#Iterator</a>
It has to go out of its way to say "please do not corrupt my memory". If
somebody uses memdb directly
(<a href="http://godoc.org/code.google.com/p/leveldb-go/leveldb/memdb)">http://godoc.org/code.google.com/p/leveldb-go/leveldb/memdb)</a> and misuses the Iterator
type, all the sudden the memory corruption and stack traces implicate the memdb package,
even though it's a caller of memdb who violated the db.Iterator contract.
All leveldb really wants is to give callers a view of the bytes.
That is, in addition to "string" with its promise A (handle for life) and
"[]byte" with its promise B (you can mutate), we need a a common type to both
of those with neither promise, what is constant-time assignable from a string or a
[]byte.
s := "string"
b := []byte(s)
var v byteview = s // constant time assignment
var v byteview = b // constant time assignment
A byteview would be represented in memory just like a string (*byte, int), but the
compiler would prevent mutations or addressing (like string), and callers would always
treat its backing data as ephemeral, like a []byte, unless negotiated otherwise.
Obviously this isn't a Go 1.n item, considering the impact it would have on the standard
library.
A good name for byteview would be "bytes", but we have a package
"bytes" already. Maybe we can get rid of that package.</pre>
| LanguageChange,Proposal,LanguageChangeReview | medium | Major |
51,283,633 | go | path/filepath: Glob is case-sensitive on Windows | by **[email protected]**:
<pre>What steps will reproduce the problem?
Copy the program at <a href="http://play.golang.org/p/9G14FfcKES">http://play.golang.org/p/9G14FfcKES</a> into a .go file and run in a
directory that has write permissions (it will create the test.txt file).
What is the expected output?
Files found with *.txt: [test.txt]
Files found with *.TXT: [test.txt]
What do you see instead?
Files found with *.txt: [test.txt]
Files found with *.TXT: []
Which compiler are you using (5g, 6g, 8g, gccgo)?
8g
Which operating system are you using?
Windows 8 64-bit
Which version are you using? (run 'go version')
go version go1.1rc3 windows/386
File paths on Windows are normally case-insensitive, but the filepath.Glob is currently
case-sensitive on Windows. I would expect it to be case-sensitive if the OS has
case-sensitive paths, and be case-insensitive if the OS has case-insensitive paths.</pre>
| OS-Windows,NeedsDecision | medium | Critical |
51,283,668 | go | proposal: net/http/v2: thoughts for Go 2.0 | <pre>Wishlist bug for what net/http would look like if we could make backwards-incompatible
changes.
Anything goes.
I'll start:
* Handler (<a href="http://golang.org/pkg/net/http/#Handler)">http://golang.org/pkg/net/http/#Handler)</a> currently takes a pointer to a 208
byte Request struct.
* The Request struct (<a href="http://golang.org/pkg/net/http/#Request)">http://golang.org/pkg/net/http/#Request)</a> has all its fields
publicly exposed, most of which require memory allocation:
-- Method
-- URL (itself 104 bytes, with a bunch of strings requiring allocation)
-- Header map + slices + strings (even if never accessed)
-- TransferEncoding slice (even if not accessed)
-- Host string (even if not accessed)
-- RemoteAddr string (even if not accessed)
-- RequestURI (even if not accessed)
-- TLS state struct (even if not accessed)
For a lightweight handler that doesn't touch anything (say, serves some static content
from memory), this means we can't do any better than generating ~1KB of garbage per
request.
I'd prefer to make a ServerRequest interface with accessor methods which can generate
needed data on demand.
This would also simplify our docs on our doubly-abused-in-different-ways *Request, which
contains documentation gems like:
// PostForm contains the parsed form data from POST or PUT
// body parameters.
// This field is only available after ParseForm is called.
// The HTTP client ignores PostForm and uses Body instead.
PostForm url.Values
If we had byte views (<a href="https://golang.org/issue/5376">issue #5376</a>), I would also say that most fields in the
ServerRequest, URL, Header, and FormValues are all byte views with validity scoped to
the duration of the http.Handler call, instead of strings.</pre>
| v2 | high | Critical |
51,283,724 | go | cmd/link: external linker generates larger binaries than 6l/8l | by **unclejacksons**:
<pre>What steps will reproduce the problem?
Using 6l from Go 1.1:
go build -ldflags '-s -linkmode internal' -tags release
github.com/valyala/ybc/apps/go/memcached
wc -c memcached
1562016 memcached
Using Go 1.1 the patch which passes '-s' to ld:
go build -ldflags '-s' -tags release github.com/valyala/ybc/apps/go/memcached
wc -c memcached
2096920 memcached
Using Go 1.1 release:
wc -c memcached
3194317 memcached
What is the expected output?
The resulting binary linked with the external linker should be smaller, its size should
be closer to that of the binary linked with 6l.
Since Go 1.1 defaults to using the external linker because it's more mature, it should
generate smaller binaries.
Which compiler are you using (5g, 6g, 8g, gccgo)?
6g
Which operating system are you using?
Ubuntu 13.04 amd64
Which version are you using? (run 'go version')
go version go1.1 linux/amd64 from
<a href="https://go.googlecode.com/files/go1.1.linux-amd64.tar.gz">https://go.googlecode.com/files/go1.1.linux-amd64.tar.gz</a>
What can be done to make the resulting binaries smaller?</pre>
| NeedsInvestigation | low | Major |
51,283,732 | go | go/types: named types defined within a function print as if defined at package scope | <pre>package main
type T int
func f() {
type T int
}
Both of these types are printed as "main.T". This is ambiguous and confusing;
the f-local type should have a different name. Not sure what 6g does.</pre>
| NeedsInvestigation | low | Major |
51,283,815 | go | gdb: nothing works (windows amd64) | by **SmileKZS**:
<pre>## What steps will reproduce the problem?
1. <a href="https://gist.github.com/smilekzs/5640921">https://gist.github.com/smilekzs/5640921</a>
2. go build test.go
3. gdb test.exe
4. run the following
```
(gdb) break main.main
(gdb) r
(gdb) n
(gdb) n
(gdb) n
(gdb) p s
(gdb) p S
(gdb) p I
(gdb) info goroutines
```
## What is the expected output?
Print value of `s`, `S`, and `I`
List goroutines.
## What do you see instead?
```
(gdb) p s
No symbol "s" in current context.
(gdb) p S
No symbol "S" in current context.
(gdb) info goroutine
```
Then it crashes.
## Which compiler are you using (5g, 6g, 8g, gccgo)?
go build test.go
(6g I suppose?)
##Which operating system are you using?
Windows 8 amd64.
Same results on two windows 8 boxes.
## Which version are you using? (run 'go version')
go version go1.1 windows/amd64
## Please provide any additional information below.
* Go 1.1, official windows amd64 msi installer.
* Python 2.6, official installer.
* GDB 7.4 amd64 with python26 support, from
<a href="https://code.google.com/p/go-w64/downloads/list">https://code.google.com/p/go-w64/downloads/list</a>
* Environment properly set.
Workaround batch script for <a href="https://golang.org/issue/5458">https://golang.org/issue/5458</a> :
<a href="https://gist.github.com/smilekzs/5640649">https://gist.github.com/smilekzs/5640649</a>
BTW: It's really hard to find a working GDB amd64 binary with Python support. Before I
even hit this bug, there's the necessity of a workaround (otherwise GDB can't even find
the runtime sources -- see issue #5458 for details). How can we have no first-class
debug tool that Just Works?</pre>
| ExpertNeeded,OS-Windows | medium | Critical |
51,283,854 | go | x/net/ipv4: an address as a result of routing table lookup for source-routing, source address selection | <pre>In addition to Dst and IfIndex, ControlMessage should contain a member corresponding to
ipi_spec_dst, from struct in_pktinfo. This is available when IP_PKTINFO is set.
It's necessary when the IP address that a packet is received on is required, rather than
the header destination address (which is what Dst represents).</pre>
| NeedsInvestigation | medium | Critical |
51,283,909 | go | net/http/cgi: allow chunked body in request | by **cgmurray**:
<pre>What steps will reproduce the problem?
Why are requests with chunked transfer encoding not permitted in http/cgi? Is this
according to the cgi specification? Git sends data (push) with chunked transfer encoding
and I believe that it's supported in Apache.
Side-note: By disabling the error-check in ServeHTTP chunked requests seems work in
general but when sending large data, >= 1MB, in combination with writing the
"Content-Type" header the request data seems to be corrupted. Any other
header, e.g. "_Content-Type" works however.
Which version are you using? (run 'go version')
go version go1.1 darwin/amd64</pre>
| Suggested,help wanted,NeedsInvestigation | medium | Critical |
51,283,955 | go | cmd/link: add eabi tag to arm binary | by **namsgorf**:
<pre>What steps will reproduce the problem?
1. Run "readelf -A -- /path/to/go/binary"
What is the expected output?
Something like the following, which is the result of running the same command on
/bin/bash instead:
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "7-A"
Tag_CPU_arch: v7
Tag_CPU_arch_profile: Application
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-2
Tag_FP_arch: VFPv3-D16
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_rounding: Needed
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: int
Tag_ABI_HardFP_use: SP and DP
Tag_ABI_VFP_args: VFP registers
Tag_CPU_unaligned_access: v6
What do you see instead?
No output; zero exit status.
Which compiler are you using (5g, 6g, 8g, gccgo)?
N/A
Which operating system are you using?
Ubuntu Saucy
Which version are you using? (run 'go version')
go version go1.1 linux/arm
Please provide any additional information below.
See <a href="https://bugs.launchpad.net/ubuntu/+source/golang/+bug/1187722">https://bugs.launchpad.net/ubuntu/+source/golang/+bug/1187722</a> for a golang build
problem this caused.
The ARM Architecture ABI r2.09 Addenda specifies the "eabi" attribute tags. In
this case, a Tag_ABI_VFP_args setting of VFP would allow tools to detect the binary as
armhf. I think this could be achieved with:
.eabi_attribute 28, 1
But note that this bug is a request to add all useful attributes in general, rather than
the specific issue that prompted this report.
I'm trying to find out if is a requirement that ARM executables specify this information
if they want to link with system libraries that do. Nevertheless, it would be useful as
a wishlist item for the go binaries to provide this information so that distribution
tooling can make use of it.</pre>
| NeedsInvestigation | low | Critical |
51,284,037 | go | regexp: no way to replace submatches with a function | by **denys.seguret**:
<pre>ReplaceAllStringFunc is useful when you need to process the match to compute the
replacement, but sometimes you need to match a bigger string than the one you want to
replace. A similar function able to replace submatch(es) seems necessary.
Let's say you have strings like
input := `bla b:foo="hop" blabla b:bar="hu?"`
and you want to replace the part between quotes in b:foo="hop" and
b:bar="hu?" using a function.
It's easy to build a regular expression to get the match and submatch, for example
r := regexp.MustCompile(`\bb:\w+="([^"]+)"`)
but when you use ReplaceAllStringFunc, the callback is only provided the whole match,
not the submatch, and must return the whole string. Practically this means you need to
execute the regexp (or another one) in the callback, for example like this :
input := `bla bla b:foo="hop" blablabla b:bar="hu?"`
r := regexp.MustCompile(`(\bb:\w+=")([^"]+)`)
fmt.Println(r.ReplaceAllStringFunc(input, func(m string) string {
parts := r.FindStringSubmatch(m)
return parts[1] + complexFunc(parts[2])
}))
I think a function ReplaceAllStringSubmatchFunc would be useful and would avoid the
second pass. The callback would receive the submatch and return the replacement of the
submatch. The last example would be rewritten as
input := `bla bla b:foo="hop" blablabla b:bar="hu?"`
r := regexp.MustCompile(`\bb:\w+="([^"]+)"`)
fmt.Println(r.ReplaceAllStringSubmatchFunc(input, complexFunc))
A similar function (ReplaceAllStringSubmatchSliceFunc ?) could be designed to give the
callback an array of strings that the callback would change. In fact it could be decided
that only this last function is really necessary.
Links :
- "How-to" question on Stack-Overflow : <a href="http://stackoverflow.com/q/17065465/263525">http://stackoverflow.com/q/17065465/263525</a>
- Playground link : <a href="http://play.golang.org/p/I6Pg8OUeTj">http://play.golang.org/p/I6Pg8OUeTj</a></pre>
| NeedsInvestigation | high | Critical |
51,284,065 | go | reflect: field lookup ignores methods that cancel fields (ambiguity is ignored) | <pre>1) $ cat x.go
package main
import "reflect"
type S1 struct {
m int
}
type S2 struct{}
func (S2) m() int { return 0 }
type S struct {
S1
S2
}
func main() {
var s S
t := reflect.TypeOf(s)
if f, ok := t.FieldByName("m"); ok {
println("field found:", f.Name)
} else {
println("field not found")
}
}
2) $ go run x.go
field found: m
But in truth, the field m and the method m are at the same level and thus "cancel
each other out". In the same program, accessing s.m leads to a compile-time error (
ambiguous selector s.m ).
The bug is in <a href="http://golang.org/src/pkg/reflect/type.go?#L856">http://golang.org/src/pkg/reflect/type.go?#L856</a>
(structType.FieldByNameFunc) which ignores methods.</pre>
| NeedsInvestigation | low | Critical |
51,284,067 | go | all: test fails on IPv4- or IPv6-only kernels | <pre><a href="http://www.freebsd.org/ipv6/ipv6only.html">http://www.freebsd.org/ipv6/ipv6only.html</a>
Sure, it fails, of course.</pre>
| Testing | low | Minor |
51,284,068 | go | x/net/ipv4: test fails on IPv6-only kernels | <pre><a href="http://www.freebsd.org/ipv6/ipv6only.html">http://www.freebsd.org/ipv6/ipv6only.html</a>
Sure, it fails.</pre>
| NeedsInvestigation | low | Major |
51,284,073 | go | cmd/compile: emits unnecessary deferreturn | <pre>parent: 17086:2879112bff3d tip, linux/amd64
The program is:
package main
import "sync"
func main() {
println(foo(0))
}
func foo(x int) int {
// fast path
if x != 42 {
return x
}
// slow path
mu.Lock()
defer mu.Unlock()
seq++
return seq
}
var (
mu sync.Mutex
seq int
)
The generated code for fast path is:
func foo(x int) int {
400c40: 64 48 8b 0c 25 f0 ff mov %fs:0xfffffffffffffff0,%rcx
400c47: ff ff
400c49: 48 3b 21 cmp (%rcx),%rsp
400c4c: 77 05 ja 400c53 <main.foo+0x13>
400c4e: e8 bd 81 01 00 callq 418e10 <runtime.morestack16>
400c53: 48 83 ec 08 sub $0x8,%rsp
400c57: 48 8b 44 24 10 mov 0x10(%rsp),%rax
400c5c: 48 c7 44 24 18 00 00 movq $0x0,0x18(%rsp)
400c63: 00 00
if x != 42 {
400c65: 48 83 f8 2a cmp $0x2a,%rax
400c69: 74 0f je 400c7a <main.foo+0x3a>
return x
400c6b: 48 89 44 24 18 mov %rax,0x18(%rsp)
}
mu.Lock()
defer mu.Unlock()
seq++
return seq
}
400c70: e8 eb b7 00 00 callq 40c460 <runtime.deferreturn>
400c75: 48 83 c4 08 add $0x8,%rsp
400c79: c3 retq
If the compiler performs some CFG analysis, it can figure out that 'callq
runtime.deferreturn' is unnecessary in this case.</pre>
| Performance | low | Major |
51,284,089 | go | sync/atomic: support int/uint types | <pre>Add operations on int/uint types to sync/atomic package.
int is used as indices/len/cap by slices/maps/chans, widely used in
std lib interfaces and seems to be the "default" integer type
otherwise.
Current atomic interface forces to use casts to work with int type.
Casts are ugly.
There is another unpleasant implication -- the casts make code less
portable because force you to say explicitly how many bits you expect
int is.
If int64 is used instead of int for the sake of atomic operations, it incurs performance
penalty on 32-bit platforms, and raises alignment issues.</pre>
| Thinking | medium | Major |
51,284,095 | go | x/pkgsite: option to show "exported" declarations of main packages | <pre>What steps will reproduce the problem?
1. Run godoc -http=:8080
2. Go to <a href="http://localhost:8080/pkg/">http://localhost:8080/pkg/</a>
3. Click on a package that is main
What is the expected output?
Documentation for exported components.
What do you see instead?
A blank page.
Which operating system are you using?
Mac OS X, Linux
Which version are you using? (run 'go version')
Go1.1 (it worked in Go1.0)
Please provide any additional information below.
Our company uses Go as our primary language, and we have been successfully for a year
now. All we really want is a command-line option in godoc to export main like it used to
do in Go1.
This is for internal reasons. We use it to distinguish finalized verses experimental
functionality in our binaries, much like you would export something in a package to make
it available for use. This was extremely helpful in our company Hackathon - we would
communicate RPC calls to our iPhone developer without verbal communication. We got a lot
done. We've used this day to day, and it has helped a lot. Now we can't do this in Go
1.1.</pre>
| NeedsInvestigation | medium | Major |
51,284,235 | go | encoding/gob: encoder should ignore embedded structs with no exported fields | by **alan.strohm**:
<pre>What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. <a href="http://play.golang.org/p/ayZMy_HFKE">http://play.golang.org/p/ayZMy_HFKE</a>
What is the expected output?
"worked"
I don't see why hidden1 (an unexported field in an embedded struct) should be handled
differently than hidden2 (a top level unexported field). Making the embedded struct type
itself unexported ("inner" vs "Inner") works but seems unecessary.
What do you see instead?
gob: type main.Inner has no exported fields</pre>
| NeedsInvestigation | medium | Critical |
51,284,302 | go | x/pkgsite: show interface methods more prominently | by **[email protected]**:
<pre>Right now, the whole interface has one link, and its code is included in its entirety.
This is not very clear, as many interfaces are the main public entry point for many
libraries. What I would like to see:
1. The index should contain links to interface methods.
2. Interface methods doccomments should be displayed in a way similar to normal
method/function doccomments.</pre>
| NeedsDecision,pkgsite | medium | Critical |
51,284,360 | go | encoding/json: allow per-Encoder/per-Decoder registration of marshal/unmarshal functions | <pre>For example, if a user wants to marshal net.IP with custom code, we should provide a way
to do that, probably a method on *Encoder. Similarly for *Decoder.
Same for encoding/xml.</pre>
| Proposal,Proposal-Accepted,early-in-cycle | high | Critical |
51,284,379 | go | cmd/link: move symtab out of mapped memory | <pre>Nothing in package runtime looks at the Go 'symtab' symbol anymore. Move it into
unmapped memory, so that it is still in the file for debuggers but not mapped while the
program runs.
Low priority, since the size of the file will not be changing, and since the data is
never paged in, the total memory cost is under two pages of memory partially used by
fragmentation, so less than 8 kB.</pre>
| NeedsInvestigation | low | Critical |
51,284,385 | go | cmd/compile: missed escape analysis opportunity | <pre>Escape analysis says that s escapes in this function even though it doesn't:
func f(s *string) {
*s = *s
}
If f is called as f(&s), the compiler will (with inlining disabled) allocate s on
the heap even though it could be allocated on the stack. For types that don't contain
pointers, this doesn't happen. For example, if I change string to int, the parameter
isn't considered to escape.
A real-world example of when this might happen is when a function takes a pointer to a
string or slice and then re-slices it:
*s = (*s)[n:]</pre>
| NeedsInvestigation | medium | Major |
51,284,439 | go | cmd/cgo: atexit handlers not run | by **davidgreymackay**:
<pre>What steps will reproduce the problem?
Save the attached files into a directory and run make,
then run ./stmain
What is the expected output?
"This is a test." should display on the console.
What do you see instead?
Nothing.
Which compiler are you using (5g, 6g, 8g, gccgo)?
6c, 6g, 6l
swig 2.0.10
Which operating system are you using?
Fedora 19 linux
Which version are you using? (run 'go version')
1.1.1-1
Please provide any additional information below.
Per Ian Taylor [email protected], changing pinput to cout<<pstring<<std::endl;
does display.</pre>
Attachments:
1. <a href="https://storage.googleapis.com/go-attachment/5948/0/st.i">st.i</a> (166 bytes)
2. <a href="https://storage.googleapis.com/go-attachment/5948/0/st.cxx">st.cxx</a> (164 bytes)
3. <a href="https://storage.googleapis.com/go-attachment/5948/0/stmain.go">stmain.go</a> (87 bytes)
4. <a href="https://storage.googleapis.com/go-attachment/5948/0/Makefile">Makefile</a> (615 bytes)
| NeedsInvestigation | low | Major |
51,284,522 | go | text/tabwriter: elide trailing padding when last cell is empty | <pre>I would like to suggest a new switch for tabwriter that makes it discard trailing
padding bytes when all subsequent cells on that line are empty.
See example below. The third column is only filled in the first line. It's not possible
to align that cell right of the second column without having extra padding on the second
line.
<a href="http://play.golang.org/p/lW5-7CFrNC">http://play.golang.org/p/lW5-7CFrNC</a>
package main
import (
"fmt"
"os"
"text/tabwriter"
)
func main() {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, '*', 0)
fmt.Fprintln(w, "x\tx\tx")
fmt.Fprintln(w, "aaaa\tbbb")
w.Flush()
fmt.Fprintln(w, "x\tx\tx")
fmt.Fprintln(w, "aaaa\tbbb\t")
w.Flush()
}
x****x*x
aaaa*bbb
x****x***x
aaaa*bbb*
(Obviously, this is much more useful for trailing whitespace.)</pre>
| NeedsInvestigation | low | Major |
51,284,631 | go | cmd/vet: diagnose set and not used | <pre>If you have:
x := 1
_ = x
x = 2
the spec allows this program and therefore the compilers accept it without comment.
However, it would be nice if vet could tell you about 'set and not used' on the final
line.
Maybe this falls out of some code Alan already has lying around. Maybe not.</pre>
| Analysis | low | Major |
51,284,667 | go | encoding/xml: more tests | <pre>encoding/xml is under-tested. Now that we have go tool cover, it might be nice to write
some more tests, especially of things like name spaces, custom marshalers, custom
unmarshalers, and the interaction between all those.</pre>
| Suggested,Testing | medium | Major |
51,284,684 | go | runtime: threadcreate profile is broken | <pre>With the new scheduler threadcreate profile is broken. Most of the threads are created
by sysmon thread, which stack is not very informative.
We need to either remove the profile, or capture stack of the blocking cgo/syscall that
caused new thread creation.</pre>
| compiler/runtime | medium | Critical |
51,284,716 | go | x/pkgsite: show embedded methods | <pre>Fix the cmd/godoc side of issue
<a href="https://code.google.com/p/go/source/detail?r=f5b37c93e4c5bb2962c">https://code.google.com/p/go/source/detail?r=f5b37c93e4c5bb2962c</a> added some methods to
go1.txt that were always there, but neither cmd/godoc nor cmd/api (both with their own
bad embedding rules) detected.
Robert's rewrite of cmd/api to use go/types fixed cmd/api, but cmd/godoc is still broken.
This bug is about making those methods (like <a href="https://golang.org/issue/6125">issue #6125</a> -- xml.Encoder.Reset / Available
/ etc) show up, if they're actually there. (But <a href="https://golang.org/issue/6125">issue #6125</a> should remove them)</pre>
| NeedsDecision,Tools | medium | Critical |
51,284,729 | go | sync/atomic: 64-bit primitives are not supported on ARMv5 | <pre>The following change introduced the armSwapUint64
<a href="https://code.google.com/p/go/source/detail?r=41d393af9bb8">https://code.google.com/p/go/source/detail?r=41d393af9bb8</a>
This function, written in assembly, uses newer ARM instructions to perform a double
width LL/SC. I believe this code is correct.
For older ARM processors, which are supported by Go, these instructions do not exist.
On Linux, there is a primitive provided by the kernel that cooperates with the scheduler
to provide a the same primitive. However, non-Linux targets do not have similar
functionality.
Since non-Linux ARM targets are not generally well supported, a viable option might be
to discontinue support for ARMv5 CPUs on those systems and require a CPU that supports
at least the ARMv6K instructions.</pre>
| NeedsInvestigation | low | Major |
51,284,806 | go | sync: detect copying of Mutex | <pre>Discussion on golang-dev:
<a href="https://groups.google.com/forum/#">https://groups.google.com/forum/#</a>!searchin/golang-dev/copying$20sync.mutex/golang-dev/3jCp3vd4BQ8/dqjjePtV8iwJ
sync.Mutex can use the same technique as sync.Cond to detect copying.
Package docs says "Values containing the types defined in this package should not
be copied".
It will also help to simplify runtime code and make Mutexes faster.
Brad raised the concern that it will increase size of Mutex.</pre>
| NeedsInvestigation | low | Major |
51,284,831 | go | cmd/compile: poor performance when accessing slices for numerical work (multiplying vectors) | by **dean.w.schulze**:
<pre>Running the enclosed code the best runtime is 6.45 seconds. The same code in Java (JDK
1.7) runs in 4.8 seconds, a serious performance hit.
For simple slice (go) / array (Java) access I would expect similar runtime performance.
Go and Java code is below.
Which operating system are you using?
go version go1.1.2 linux/amd64
This is a VM running on OSX host. Similar results on Windows 7 64-bit
============================================================
package main
import (
"fmt"
"time"
)
func main() {
sz := 100000
sl1 := make([]int32, sz)
for j := range sl1 {
sl1[j] = int32(j)
}
sl2 := make([]int32, sz)
for j := range sl2 {
sl2[j] = int32(j*2)
}
multiplySlices(sl1, sl2)
multiplySlices_(sl1, sl2)
multiplySlices__(sl1, sl2)
}
func multiplySlices(sl1 []int32, sl2 []int32) {
start := time.Now()
var num int64 = 0
for _, n1 := range sl1 {
var n int64 = 0
for _, n2 := range sl2 {
n += int64(n1 * n2)
}
num += n
}
et := time.Since(start)
fmt.Println("")
fmt.Println("multiplySlices")
fmt.Println(et)
fmt.Println(num)
}
func multiplySlices_(sl1 []int32, sl2 []int32) {
start := time.Now()
var num int64 = 0
for _, n1 := range sl1 {
for _, n2 := range sl2 {
num += int64(n1 * n2)
}
}
et := time.Since(start)
fmt.Println("")
fmt.Println("multiplySlices_")
fmt.Println(et)
fmt.Println(num)
}
func multiplySlices__(sl1 []int32, sl2 []int32) {
start := time.Now()
var num int64 = 0
for i := range sl1 {
n := sl1[i]
for j := range sl2 {
num += int64(n * sl2[j])
}
}
et := time.Since(start)
fmt.Println("")
fmt.Println("multiplySlices__")
fmt.Println(et)
fmt.Println(num)
}
=======================================================================
package arraytest;
import java.util.Date;
public class Driver {
public static void main(String[] args) {
int sz = 100000;
int[] arr1 = new int[sz];
int[] arr2 = new int[sz];
for (int i = 0; i < sz; i++) {
arr1[i] = i;
arr2[i] = i * 2;
}
mutiplyArrays(arr1, arr2);
mutiplyArrays_(arr1, arr2);
}
private static void mutiplyArrays(int[] arr1, int[] arr2) {
int sz = arr1.length;
Date start = new Date();
long num = 0;
for (int i = 0; i < sz; i++) {
int n = arr1[i];
long acc = 0;
for (int j = 0; j < sz; j++) {
acc += n * arr2[j];
}
num += acc;
}
Date end = new Date();
long l = end.getTime() - start.getTime();
System.out.println(l + " ms.");
System.out.println(num);
}
private static void mutiplyArrays_(int[] arr1, int[] arr2) {
int sz = arr1.length;
Date start = new Date();
long num = 0;
for (int i = 0; i < sz; i++) {
int n = arr1[i];
for (int j = 0; j < sz; j++) {
num += n * arr2[j];
}
}
Date end = new Date();
long l = end.getTime() - start.getTime();
System.out.println(l + " ms.");
System.out.println(num);
}
}</pre>
| Performance | low | Major |
51,284,841 | go | proposal: encoding/json: add "inline" struct tag | by **bjruth**:
<pre>Discussion was conceived on golang-nuts:
<a href="https://groups.google.com/forum/#!topic/golang-nuts/bAgNll-EMkI">https://groups.google.com/forum/#!topic/golang-nuts/bAgNll-EMkI</a> to add support for a
flag that supports unmarshaling arbitary JSON into structs. A tag was announced for the
mgo/bson package here:
<a href="https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/ZeP7PaXVDQo">https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/ZeP7PaXVDQo</a> that
transparently stores data into a separate struct field denoted by "inline"
during an unmarshal and then merges that data back into the output during marshaling.
I believe this would be a very useful feature to add into the encoding/json package and
does not introduce any breaking changes in the Go 1.x series.</pre>
Edited by @dsnet on 2020-11-10 to fix formatting.
| Proposal,Proposal-Hold | high | Critical |
51,284,973 | go | runtime: win32 should support more than 64 processors | <pre>Windows 7 and Windows Server 2008 support up to 256 processors. It seems that, by
default, a process is constrained to running in a single processor group which can be as
large as 64 processors. To support more than 64 processors the scheduler needs to
become aware of "processor groups" and allocate threads explicitly to
different processor groups.
Processor groups are explained on the following page
<a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd405503(v=vs.85).aspx">http://msdn.microsoft.com/en-us/library/windows/desktop/dd405503(v=vs.85).aspx</a>
Microsoft also publishes a document generally describing how to support systems with
>64 processors
<a href="http://msdn.microsoft.com/en-us/windows/hardware/gg463349.aspx">http://msdn.microsoft.com/en-us/windows/hardware/gg463349.aspx</a></pre>
| OS-Windows | low | Minor |
51,285,015 | go | cmd/link: linker cannot discard unused but runtime-initialized global variables | <pre>The code.google.com/p/go.text/encoding/charmap package contains variable pairs like:
var CodePage437 encoding.Encoding = &codePage437
var codePage437 = charmap{ /* a data table */ }
encoding.Encoding is an interface, so that the CodePage437 variable currently requires a
convT2I call, in a package init function. (<a href="https://golang.org/issue/6289">issue #6289</a> is possibly related, but even if
that was fixed, suppose for argument's sake that CodePage437 was initialized by a
constructed-at-runtime composite literal.)
Because CodePage437 is implicitly referenced by a package init function, the linker
considers it used by any program that imports that package, even if it otherwise doesn't
refer to CodePage437. The linker thus can't drop the unused data table (and maybe other
related metadata like pclntab??), and likewise for the N other encoding.Encoding
implementations in that package.</pre>
| NeedsInvestigation | low | Minor |
51,285,044 | go | gdb: 'next' command confused by cgo calls | by **kaoshi.juan82**:
<pre>What steps will reproduce the problem?
write these code:
package main
//#include <stdio.h>
/*
void Print(int i){
printf("result:%d\n",i);
}
*/
import "C"
func A() {
a := 1
b := 2
c := 4
C.Print((C.int)(a+b+c))
}
func main() {
a := 1
b := 2
c := 3
A() //gdb n command will step into this function
C.Print((C.int)(a+b+c))
}
What is the expected output?
if you press n at the line function call of A() while debugging, you should step over
the function call
What do you see instead?
instead, you step into the function.
Which compiler are you using (5g, 6g, 8g, gccgo)?
compiler is gcc (cgo) + 6g,
Which operating system are you using?
under centos x86_64, gdb 7.4, and gcc 4.1.2
Which version are you using? (run 'go version')
go 1.1.2</pre>
| NeedsInvestigation | low | Critical |
51,285,097 | go | crypto/tls: add PSK support | by **tiebingzhang**:
<pre>RFC 4279 (<a href="http://tools.ietf.org/html/rfc4279#page-10)">http://tools.ietf.org/html/rfc4279#page-10)</a> added PSK to TLS.
OpenSSL and GnuTLS already have support for it.
The RFC defines three additional key exchange algorithms:
PSK
RSA-PSK
DHE-PSK
It would be nice to add at least PSK and DHE-PSK to GO's crypto/tls package. The work
seems to be reasonable size.
According to Wikipedia
(<a href="http://en.wikipedia.org/wiki/Comparison_of_TLS_implementations#Key_Exchange_Algorithms_.28Alternative_key-exchanges.29)">http://en.wikipedia.org/wiki/Comparison_of_TLS_implementations#Key_Exchange_Algorithms_.28Alternative_key-exchanges.29)</a>,
RSA-PSK has not been implemented by any of the listed implementations, so it is maybe
okay to push that one off for later.</pre>
| NeedsDecision,FeatureRequest,Proposal-Crypto | high | Critical |
51,285,104 | go | proposal: spec: allow constants of arbitrary data structure type | by **RickySeltzer**:
<pre>var each1 = []byte{'e', 'a', 'c', 'h'}
const each2 = []byte{'e', 'a', 'c', 'h'}
The 'var' is accepted, the 'const' is not. This is a defect in the language spec and
design.
1. What is a short input program that triggers the error?
<a href="http://play.golang.org/p/Jbo9waCn_h">http://play.golang.org/p/Jbo9waCn_h</a>
2. What is the full compiler output?
prog.go:7: const initializer []byte literal is not a constant
[process exited with non-zero status]</pre>
| LanguageChange,Proposal,LanguageChangeReview | high | Critical |
51,285,242 | go | spec: clarify intended behaviour of method values using promoted methods | <pre>What steps will reproduce the problem?
Run this program:
<a href="http://play.golang.org/p/pQb9VlrLkv">http://play.golang.org/p/pQb9VlrLkv</a>
What is the expected output?
Based on the spec, it's not clear if this should print "1 1" or "1
2".
What do you see instead?
Running the program in the go playground prints "1 1".
Which compiler are you using (5g, 6g, 8g, gccgo)?
Go playground.
Which operating system are you using?
n/a
Which version are you using? (run 'go version')
go1.1.2
Please provide any additional information below.
The spec mentions auto-referencing/dereferencing the x in method value expression x.M as
necessary so that it matches the kind of receiver M has, which is why the call to tFn is
expected to print 1. It doesn't mention resolving x to the value that will ultimately
used to initialize the receiver-parameter visible in the body of the method M. Instead,
it says that x is evaluated and saved to be used as the receiver. Note that receiver has
multiple meanings used in the spec, depending on whether you're talking about the
receiver-argument or the receiver-parameter.
Depending on the intended behaviour, this may also be a compiler bug.</pre>
| Documentation,NeedsInvestigation | low | Critical |
51,285,273 | go | proposal: os/v2: Chown expects int, but os/user uses strings | <pre>[Noting down confusion from IRC]
Chown takes ints, os/user Lookup returns strings. If someone wants to "chown jdoe
file", they're supposed to have platform-specific code to strconv from os/lookup
strings to ints?
I know backwards-compatibility means changes are hard, but this API does not seem ideal.
func Chown(name string, uid, gid int) error
<a href="http://golang.org/pkg/os/#Chown">http://golang.org/pkg/os/#Chown</a>
type User struct { Uid string; ... }
<a href="http://golang.org/pkg/os/user/#User">http://golang.org/pkg/os/user/#User</a>
I understand different platforms do different things -- but surely, if a platform has
Chown that operates on ints, surely it should have an API that produces ints too. Or a
cross-platform User abstraction that can be passed to Chown (where Chown exists).</pre>
| v2,Proposal | low | Critical |
51,285,295 | go | runtime/race: eliminate dependency on cmd/cgo | <pre>There is a circular dependency between runtime/race and cmd/cgo in -race build.
Everything depends on runtime/race, but runtime/race is a cgo package.
Currently it's resolved by a hack in go tool:
// If we are not doing a cross-build, then record the binary we'll
// generate for cgo as a dependency of the build of any package
// using cgo, to make sure we do not overwrite the binary while
// a package is using it. If this is a cross-build, then the cgo we
// are writing is not the cgo we need to use.
if goos == runtime.GOOS && goarch == runtime.GOARCH && !buildRace {
We pretend that packages do not depend on cmd/cgo. But as the result we can overwrite
cmd/cgo binary while it is used.
A better solution is to make runtime/race to be not dependent on cmd/cgo.</pre>
| RaceDetector,FeatureRequest | medium | Major |
51,285,340 | go | misc/swig: long long not working with gcc 4.7 on Windows | <pre>What steps will reproduce the problem?
1. grab the file at <a href="https://gist.github.com/steeve/6872454">https://gist.github.com/steeve/6872454</a>
2. on windows/386: go run test-int64.go
What is the expected output?
1
What do you see instead?
4603183328
Which compiler are you using (5g, 6g, 8g, gccgo)?
8g, cgo on mingw32 + msys
Which operating system are you using?
windows 7
Which version are you using? (run 'go version')
go version go1.1.2 windows/386
Please provide any additional information below.
Running this on darwin/amd64 and windows/amd64 works perfectly.</pre>
| OS-Windows | low | Major |
51,285,358 | go | go/printer: printed output cannot be parsed if comments are retained | <pre>This program:
<a href="http://play.golang.org/p/f3VrIs2Z70">http://play.golang.org/p/f3VrIs2Z70</a>
parses a syntactically well-formed Go program, inserts an additional statement, then
prints it out again. The result cannot be parsed because a newline was inserted in an
inappropriate place to accommodate a comment. Here's the output:
package P
func f() {
print("12"
/*hi*/)
g(0, 1)
}
Note that the length of the literal "12" is critical: if a shorter expression
is used, the /*hi*/ comment, which is retains its association with its original byte
offset, will not be inserted at that point.</pre>
| Thinking | low | Minor |
51,285,400 | go | reflect: clarify that behaviour of Value returned from Value.Method is different from method value | <pre>What steps will reproduce the problem?
<a href="http://play.golang.org/p/xPA5hW4GQe">http://play.golang.org/p/xPA5hW4GQe</a>
What is the expected output?
Some users might expect the receiver of a function value returned by Value.Method to be
evaluated the same way it is for a method value once they've removed in from reflection
land by calling Value.Interface on it.
What do you see instead?
The reflect.Value, rather than the value it represents, is still used to derive the
receiver on each call even after you remove the value from reflection land. This could
be seen as being in keeping with
"The arguments to a Call on the returned function should not include a receiver;
the returned function will always use v as the receiver."
The potentially surprising implications of this could be clarified though, since the
focus of this statement appears to be on the fact that you don't need to provide your
own receiver on each call, rather than on a deviation of the behaviour of the method
from the language feature it approximates.</pre>
| Documentation,NeedsInvestigation | low | Minor |
51,285,410 | go | cmd/compile: 8MB error message for one char error | <pre>$ cat x.go
package p
type A interface {
a() interface{AB}
}
type B interface {
a() interface{AB}
}
type AB interface {
a() interface{A;B}
b() interface{A;B}
}
var x AB
var y interface{A;B}
var _ = x == y
$ go tool 6g x.go
x.go:12: duplicate method a
x.go:13: duplicate method a
x.go:17: duplicate method a
x.go:18: invalid operation: x == y (mismatched types AB and interface { a() interface {
a() interface { a() interface { a() interface { a() interface { a() interface { a()
interface { a() interface { a() interface { a() interface { a<...>; a() interface
{ a<...>; b() interface { a<...>; a() interface { a<...>; b()
interface { a<...>; a() interface { a<...>; b() interface { a<...>;
a() interface { a<...>; b() interface { a<...>; a() interface {
a<...>; b() interface { a<...>; a<...> } } } } } } } } } } }; b()
interface { a<...>; a() interface { a() interface { a<...>; a() interface {
a<...>; b() interface { a<...>; a() interface { a<...>; b() interface
{ a<...>; a() interface { a<...>; b() interface { a<...>; a()
interface { a<...>; b() interface { a<...>; a<...> } } } } } } } } };
b() interface { a<...>; a() interface { a() interface { a<...>; a()
interface { a<...>; b() interface { a<...>; a() interface { a<...>;
b() interface { a<...>; a() interface { a<...>; b() interface {
a<...>; a<...> } } } } } } }; b() interface { a<...>; a() interface {
a() interface { a<...>; a() interface { a<...>; b() interface {
a<...>; a() interface { a<...>; b() interface { a<...>; a<...> }
} } } }; b() interface { a<...>; a() interface { a() interface { a<...>; a()
interface { a<...>; b() interface { a<...>; a<...> } } };...
$ go tool 6g x.go | wc
4 1586257 8248570
When the program is fixed (rename method a in interface B to b), the compiler runs
extremely long:
$ time go tool 6g x.go
real 0m19.170s
user 0m17.352s
sys 0m1.037s
For comparison, for the incorrect program, gccgo reports:
$ gccgo x.go
x.go:12:20: error: inherited method 'a' is ambiguous
a() interface{A;B}
^
x.go:13:20: error: inherited method 'a' is ambiguous
b() interface{A;B}
^
x.go:17:17: error: inherited method 'a' is ambiguous
var y interface{A;B}
^
x.go:18:11: error: incompatible types in binary expression
var _ = x == y
^
For the correct program, gcc does not appear slower than usual.</pre>
| NeedsInvestigation | low | Critical |
51,285,411 | go | cmd/compile: odd/inconsistent behavior with cyclic declarations | <pre>This applies to:
$ go version
go version go1.1.1 linux/amd64
The following program compiles w/o errors:
package p
import "unsafe"
type A [unsafe.Sizeof(x)]T
type T interface {
m(A)
}
var x T
Adding one extra declaration leads to a cycle error:
package p
import "unsafe"
const n = unsafe.Sizeof(x) // <<< EXTRA DECLARATION
type A [unsafe.Sizeof(x)]T
type T interface {
m(A)
}
var x T
$ go tool 6g x.go
x.go:7: typechecking loop involving x
x.go:7 unsafe.Sizeof(x)
x.go:7 []unsafe.Sizeof(x)
x.go:7 A
x.go:10 <T>
x.go:9 T
x.go:13 x
x.go:5 unsafe.Sizeof(x)
x.go:5 n
x.go:5 <node DCLCONST>
x.go:7: invalid expression unsafe.Sizeof(x)
even though the n is not even used (and thus cannot be part of a cycle). What is more
surprising even is that when moving that same declaration to the bottom of the file:
package p
import "unsafe"
type A [unsafe.Sizeof(x)]T
type T interface {
m(A)
}
var x T
const n = unsafe.Sizeof(x) // <<< EXTRA DECLARATION MOVED DOWN
the program again compiles w/o errors. But top-level declarations do not depend of
source order in Go, so this is clearly a bug somewhere.
Furthermore, using n now in the type of A:
package p
import "unsafe"
type A [n]T // <<< USING n HERE
type T interface {
m(A)
}
var x T
const n = unsafe.Sizeof(x)
appears to work fine (and changing this to a main package and printing out n produces
the correct value 16). Moving the const declaration up again, leads to the cycle error,
however with a less detailed error now:
package p
import "unsafe"
const n = unsafe.Sizeof(x) // <<< MOVED DECL UP AGAIN
type A [n]T
type T interface {
m(A)
}
var x T
$ go tool 6g x.go
x.go:5: constant definition loop
x.go:5: n uses n
x.go:7: invalid array bound n
Summary:
1) This specific program is compilable w/o a cycle since unsafe.Sizeof(x) doesn't need
to look into the internals of the interface type of x. That said, the spec doesn't say
anything about it, and one might argue that it's ok for a compiler to not handle this
esoteric case. However, 6g is inconsistent in this respect here.
2) Package-level declarations do not depend on source order. The behavior of the
compiler (error or not) should not depend on it either.
(gccgo accepts all programs w/o errors).</pre>
| NeedsInvestigation | low | Critical |
51,285,423 | go | misc/gdb: freezes and consumes CPU when using "info locals" | by **newton688**:
<pre>Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:
Run "go version" and compare against
<a href="http://golang.org/doc/devel/release.html">http://golang.org/doc/devel/release.html</a> If a newer version of Go exists,
install it and retry what you did to reproduce the problem.
Thanks.
What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Compile a relatively large Go program (e.g. github.com/sirnewton01/godev) with the go
build/install -gcflags "-N -l" option recommended here:
<a href="http://golang.org/doc/gdb">http://golang.org/doc/gdb</a>
2. Launch gdb providing the path to the program binary
2. Set a breakpoint in a section where there are plenty of complex local variables (e.g.
file.go:173 in the godev project)
3. Run the program and make it hit the breakpoint (e.g. navigate to
<a href="http://127.0.0.1:2022/navigate/table.html#">http://127.0.0.1:2022/navigate/table.html#</a> and expand different folders)
4. After the breakpoint it hit issue an "info locals" command and try to page
through the full list of local variables
What is the expected output?
It is expected that uninitialized variables should show up albeit in an undefined state
(e.g. weird characters, 0x0, or just blank).
What do you see instead?
Instead, gdb freezes. Only Ctrl-C seems to bring it back. When using an application that
uses gdb/MI for a GUI interface gdb is totally unresponsive.
Which compiler are you using (5g, 6g, 8g, gccgo)?
gc
Which operating system are you using?
Ubuntu 12.04
Which version are you using? (run 'go version')
go version devel +f4d1cb8d9a91 Thu Sep 19 22:34:33 2013 +1000 linux/amd64
-This is 1.2RC1 according to the godeb distribution
Please provide any additional information below.
I poked around in the runtime-gdb.py script and found that the to_string() of the
StringTypePrinter appears to the the culprit for the excessive CPU consumption. If I
change the implementation of this function the following the CPU problems disappear:
def to_string(self):
l = int(self.val['len'])
if l < 102400 and l > -1:
return self.val['str'].string("utf-8", "ignore", l)
return self.val['len']</pre>
| NeedsInvestigation | low | Critical |
51,285,424 | go | gdb: not showing Go strings values as initialized | by **newton688**:
<pre>Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:
Run "go version" and compare against
<a href="http://golang.org/doc/devel/release.html">http://golang.org/doc/devel/release.html</a> If a newer version of Go exists,
install it and retry what you did to reproduce the problem.
Thanks.
What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Apply the patch from <a href="https://golang.org/issue/6598">issue #6598</a> to avoid gdb freezes
2. Compile a relatively large Go program (e.g. github.com/sirnewton01/godev) with the go
build/install -gcflags "-N -l" option recommended here:
<a href="http://golang.org/doc/gdb">http://golang.org/doc/gdb</a>
3. Launch gdb providing the path to the program binary
4. Set a breakpoint in a section where there are plenty of complex local variables (e.g.
file.go:173 in the godev project)
5. Run the program and make it hit the breakpoint (e.g. navigate to
<a href="http://127.0.0.1:2022/navigate/table.html#">http://127.0.0.1:2022/navigate/table.html#</a> and expand different folders)
6. Step over a few lines that initialize some of the string variables
7. Issue an "info locals" command to look at the string variables that have
been initialized
What is the expected output?
It is expected that the string values should have a reasonable length (ie. less than
6MB) given that the strings are known to be small.
What do you see instead?
Instead, the runtime-gdb.py patch reveals that the strings have incredible length (ie.
larger than 6M) even though they have been initialized to a small string. Running
"p $len(string)" is showing a large size for the strings as well. Undoing the
runtime-gdb.py patch and using the standard version causes gdb to consume tremendous CPU
trying to xfer large chunks of memory from the target process.
Which compiler are you using (5g, 6g, 8g, gccgo)?
gc
Which operating system are you using?
Ubuntu 12.04 amd64
Which version are you using? (run 'go version')
go version devel +f4d1cb8d9a91 Thu Sep 19 22:34:33 2013 +1000 linux/amd64
-The godeb distribution indicates that this is 1.2RC1
Please provide any additional information below.</pre>
| NeedsInvestigation | low | Critical |
51,285,425 | go | x/pkgsite: show exported fields promoted from unexported anonymous fields | <pre>Within my code, I have the following structure.
type common struct {
Option1 bool
}
func (c *common) Method1() {
}
type A struct {
OptionA int
common
}
type B struct {
OptionB int
common
}
I want godoc to show that type A and type B have field Option1 available, and Method1 in
their method sets.
However, godoc would not show Option1, because common is not exported. It however show
Method1 (the full method set).
The only current workaround is to export common (which really is an internal
implementation detail), or duplicate the functionality across all types that share it.
TO fix, godoc should show these promoted fields got from unexported anonymous fields.
For example, godoc output for A could look like:
type A struct {
OptionA int
// contains filtered or unexported fields
// Available from unexported anonymous fields
Option1 bool
}
Which version are you using? (run 'go version')
go version devel +47b2b07a837f Fri Oct 11 16:39:40 2013 -0700 linux/amd64
Please provide any additional information below.</pre>
| NeedsDecision | medium | Major |
51,285,427 | go | cmd/compile: spurious error for recursive anonymous interface type | <pre><a href="http://play.golang.org/p/SV4pqRxk2g">http://play.golang.org/p/SV4pqRxk2g</a>
This program can't be linked because the compiler generates a very long symbol for an
anonymous interface type with an infinite unrolling.</pre>
| NeedsInvestigation | low | Critical |
51,285,477 | go | image/gif: encoder does not honor image bounds. | by **dan.pupius**:
<pre>1. Open a image using gif.DecodeAll
2. Replace frame(s) with a `SubImage`, e.g. to make a square crop
3. Save image using gif.EncodeAll
What is the expected output?
Saved image should correctly show cropped region
What do you see instead?
Resultant image is incorrectly offset, see lucha.out.gif vs lucha.out.jpg
Which operating system are you using?
OSX
Which version are you using? (run 'go version')
$ go version
go version devel +560ca6cc94b5 Sun Oct 20 18:29:15 2013 -0700 darwin/amd64
Please provide any additional information below.
I think the sImageDescriptor block in gif/writer.go needs to have the X/Y values
adjusted by the Min bounds of the first frame.</pre>
Attachments:
1. <a href="https://storage.googleapis.com/go-attachment/6635/0/gifs.go">gifs.go</a> (966 bytes)
2. <a href="https://storage.googleapis.com/go-attachment/6635/0/lucha.gif">lucha.gif</a> (7598 bytes)
3. <a href="https://storage.googleapis.com/go-attachment/6635/0/lucha.out.jpg">lucha.out.jpg</a> (17750 bytes)
4. <a href="https://storage.googleapis.com/go-attachment/6635/0/lucha.out.gif">lucha.out.gif</a> (6843 bytes)
| help wanted | low | Major |
51,285,480 | go | cmd/compile: internal compiler error with self-referential method in interface | <pre>$ cat x.go
package p
import "unsafe"
type T interface {
m() [unsafe.Sizeof(T(nil).m())]int
}
$ go tool 6g x.go
x.go:6: internal compiler error: getinarg: not a func E-36 <<S>> <T></pre>
| NeedsInvestigation | low | Critical |
51,285,489 | go | cmd/compile: use less memory for large []byte literal | <pre>[]byte literals take up a lot of memory inside the compiler, because each byte in the
literal is a separate syntax Node and, worse, each byte is represented by a
multiprecision integer constant.
Probably a trick is required during parsing to turn []byte{...} into an actual byte
array holding the constant values + a list of index and value for the non-constant data.</pre>
| help wanted,ToolSpeed,NeedsFix | low | Major |
51,285,499 | go | x/pkgsite: display type kind of each named type | <pre>Currently godoc does not list the base type of type, for example:
<a href="http://golang.org/pkg/encoding/json/#Decoder">http://golang.org/pkg/encoding/json/#Decoder</a>
type Decoder
func NewDecoder(r io.Reader) *Decoder
func (dec *Decoder) Buffered() io.Reader
type Marshaler
type MarshalerError
func (e *MarshalerError) Error() string
It would be really nice if this were listed as:
type Decoder struct
func NewDecoder(r io.Reader) *Decoder
func (dec *Decoder) Buffered() io.Reader
type Marshaler interface
type MarshalerError struct
func (e *MarshalerError) Error() string
It's often hard to tell if a name represents an interface or a methodless non-interface
(for example, here Decoder has the -er suffix typical of interfaces). Additionally, many
times the use of a type is much clearer if it is easily seen that it has an int as the
underlying representation (or whatever).</pre>
| NeedsInvestigation | low | Critical |
51,285,546 | go | cmd/cgo: more mkall.sh behaviour changes at tip | <pre>What steps will reproduce the problem?
Fedora 19 x86_64
gcc-4.8.1-1.fc19.x86_64
GOARCH=amd64 GOOS=linux ./mkall.sh
What do you see instead?
some constants like VDISCARD are showing up in zerrors_linux_amd64.go although they are
defined in types_linux.go, which leads to a compile error
the Rusage struct loses its field names:
type Rusage struct {
- Utime Timeval
- Stime Timeval
- Maxrss int64
- Ixrss int64
- Idrss int64
- Isrss int64
- Minflt int64
- Majflt int64
- Nswap int64
- Inblock int64
- Oublock int64
- Msgsnd int64
- Msgrcv int64
- Nsignals int64
- Nvcsw int64
- Nivcsw int64
+ Utime Timeval
+ Stime Timeval
+ Anon0 [8]byte
+ Anon1 [8]byte
+ Anon2 [8]byte
+ Anon3 [8]byte
+ Anon4 [8]byte
+ Anon5 [8]byte
+ Anon6 [8]byte
+ Anon7 [8]byte
+ Anon8 [8]byte
+ Anon9 [8]byte
+ Anon10 [8]byte
+ Anon11 [8]byte
+ Anon12 [8]byte
+ Anon13 [8]byte
}
the CSTATUS constant gets a strange value instead of 0x14 which doesn't compile:
CSTATUS = '\0'
the error is: non-octal character in escape sequence: '
the name field in InotifyEvent also changes type, which might break some code:
- Name [0]uint8
+ Name [0]int8
Which operating system are you using?
linux
Which version are you using? (run 'go version')
tip</pre>
| NeedsInvestigation | low | Critical |
51,285,566 | go | runtime/race: say where the memory block was allocated | <pre>C++ ThreadSanitizer describes where the memory involved in report was allocated:
<a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/malloc_stack.cc?revision=187875&">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/malloc_stack.cc?revision=187875&</a>;view=markup
It would be useful to do the same for Go.
C++ ThreadSanitizer can also pronounce the name of the global (if the race in on
global). Look if it's possible in Go.</pre>
| RaceDetector | low | Major |
51,285,594 | go | testing: add test helpers for measuring goroutine leaks | <pre>It's common for tests to check for goroutine leaks, but the testing package or standard
library doesn't make this easy.
These tests end up verbose and often frail.
We should provide something.</pre>
| NeedsInvestigation,FeatureRequest | medium | Critical |
51,285,606 | go | cmd/compile: skip slicebytetostring when argument doesn't escape | <pre>In this function,
func hi() string {
b := make([]byte, 0, 100) // 1st alloc
b = append(b, "Hello, "...)
b = append(b, "world.\n"...)
return string(b) // 2nd alloc, but could be removed.
}
The final line currently generates a call to runtime.slicebytetostring, causing a copy
of b to be allocated.
But the compiler already knows that b doesn't escape. It could instead return a string
header re-using the []byte memory.</pre>
| Performance,GarbageCollector | medium | Critical |
51,285,626 | go | crypto/tls: needs a convenience function for reading encrypted keys | by **jeff.allen**:
<pre>crypto/tls.X509KeyPair can't deal with encrypted key files. This wouldn't be much of a
big deal except that the quantity of code needed to work around it is really big and
repeats lots of code from the std library.
See this message: <a href="https://groups.google.com/d/msg/golang-nuts/ht_gQ2ET0c0/efaGZdIxCmAJ">https://groups.google.com/d/msg/golang-nuts/ht_gQ2ET0c0/efaGZdIxCmAJ</a>
It would be nicer to have crypto/tls.X509EncryptedKeyPair(certPEMBlock, keyPEMBlock,
password []byte) (cert Certificate, err error) that would use password to decrypt
keyPEMBlock.</pre>
| NeedsInvestigation | low | Critical |
51,285,670 | go | cmd/compile: support for explicit alignment annotations | by **rayneolivetti**:
<pre>Data alignment other than 8 bytes (ex: 128-bits, 256-bits, 512-bits) is necessary for
various instructions (belonging to SSE/AVX/AVX2 and the upcoming AVX-512). Instruction
and label alignment contributes to speed for some instructions.
It would hugely be helpful to be able to specify the alignment of data, text and
ordinary labels.
On the user mailing list, Ian mentioned the possibility of enabling similar
functionality via a magic comment.</pre>
| Thinking | low | Major |
51,285,672 | go | runtime: sockets closed by remote peer may remain undetected by poller | <pre>I have observed a network TCP server blocked on a Write although the client (Go program
located on a remote machine) has closed the connection.
So far I have been unable to produce a minimal reproducer.
My hypothesis is that the poller is not handling EPOLLRDHUP correctly. map epoll_ctl(2)
says that it means: "Stream socket peer closed connection, or shut down writing
half of connection."
But when obtaining EPOLLRDHUP from the socket the poller wakes up WaitRead() but not
WaitWrite(), so if the EPOLLRDHUP was generated by a remote close, waiting writers will
never wake up (one would expect something like "connection reset by peer").
Using linux/amd64.</pre>
| NeedsInvestigation | low | Major |
51,285,698 | go | go/types: make go/types more tolerant in case of 'import "C"' | <pre>gotype $GOROOT/src/pkg/net
leads to several error messages due to unresolvable 'import "C"'.
go/types could be more tolerant with invalid operands and types to avoid follow-up
errors.
(For instance, conversions of the form T(x) could always succeed even if x is invalid.
Other operations should not report an error if an operand is already invalid.)</pre>
| NeedsInvestigation | low | Critical |
51,285,729 | go | proposal: strings: AppendSplitN to reuse destination slice buffer | <pre>I recently found myself forking strings.SplitN to take a destination buffer, to avoid
the slice allocation.
I called it AppendSplitN, with append semantics. (like the Append funcs in
<a href="http://golang.org/pkg/strconv/)">http://golang.org/pkg/strconv/)</a>
Maybe worth putting in the strings package, although I expect the usual reservations.</pre>
| Performance,GarbageCollector | low | Minor |
51,285,770 | go | cmd/compile: improve compiler error message when accessing type instead of instance of type | <pre><a href="http://play.golang.org/p/54n3Rs7JHT">http://play.golang.org/p/54n3Rs7JHT</a>
If you have a function that has f which is a Foo, and try to reference Foo.Bar instead
of f.Bar, you get the following error message:
prog.go:10: Foo.Bar undefined (type Foo has no method Bar)
[process exited with non-zero status]
I can see where this is coming from, because it's valid syntax if you're trying to get a
method, but I wonder if there could be a different error message when Foo has the field
Bar as in this case Foo is trying to be used as a value.</pre>
| NeedsInvestigation | low | Critical |
51,285,773 | go | os: "async" file IO | <pre>Read/Write file operations must not consume threads, and use the polling similar to net
package.
This was raised several times before.
Here is a particular example with godoc:
<a href="https://groups.google.com/d/msg/golang-nuts/TeNvQqf4tO4/dskZuFH5QVYJ">https://groups.google.com/d/msg/golang-nuts/TeNvQqf4tO4/dskZuFH5QVYJ</a></pre>
| Performance,NeedsInvestigation | medium | Critical |
Subsets and Splits