sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: go
Issue: database/sql: provide optional way to mitigate convT2E allocations
Labels: NeedsInvestigation

<pre>In debugging the performance of Camlistore start-up (which slurps the index from disk to
memory), I compared two popular MySQL drivers' allocations.  Even the one that was being
careful to not allocate (go-mysql-driver) was still allocating memory proportional to
the data size (169.55 bytes in MysQL and 153.36 allocated):

2013/12/09 03:32:55 2512532 rows, 177786156 bytes; took 2.375200197s, 945ns each, 71.38
MB/s
2013/12/09 03:32:55 allocated = 160809408

I look into where the allocations were coming from.

In the go-mysql-driver's Rows.Next (<a href="http://golang.org/pkg/database/sql/driver/#Rows)">http://golang.org/pkg/database/sql/driver/#Rows)</a>
call:

     .  153.5   597: dest[i], isNull, n, err = readLengthEncodedString(data[pos:])
....
     .      .      45d2bd: MOVQ AX,18(SP)
     .  153.5      45d2c2: CALL runtime.convT2E(SB)


It's exclusively from runtime.convT2E calls, assigning a []byte to an interface{}
(driver.Value)

160809408 bytes / 2512532 rows / 2 columns = 32 bytes allocated per scanned string
[]byte column, even when the user of database/sql is trying to reduce allocations with
sql.RawBytes.

Proposal:

Right now, the <a href="http://golang.org/pkg/database/sql/driver/#Rows">http://golang.org/pkg/database/sql/driver/#Rows</a> Next method's dest
[]Value slice is purely an output that the driver is expected to write into.

If we change it to also be an optional input to the driver, we could supply it with
*[]byte and drivers can either work as they do today and write to dest, or new/updated
drivers can notice a *[]byte in dest and instead using that pointer to assign directly,
and signal that they've done so with a sentinel value:

   *(dest[i]) = rawByteSlice
   dest[i] = driver.SentinelValue

driver.SentinelValue can be a pointer, so it fits into the empty interface without
allocation.

The only other driver.Value type (<a href="http://golang.org/pkg/database/sql/driver/#Value)">http://golang.org/pkg/database/sql/driver/#Value)</a> that
is bigger than a word is time.Time.  If we care about that (and perhaps we should), we
could extend this and say that instead of a *[]byte being supplied in the dest slice of
[]driver.Value, we instead populate it with *Sink pointers.

package driver
type Sink struct {
    ....
}

func (s *Sink) SetBytes(b []byte) { ... }
func (s *Sink) SetTime(t time.Time)

And then calling a Set method on a Sink replaces the need to have a sentinel value.

If we do this, all existing drivers are still compatible.  New drivers can type-assert
for the *driver.Sink and call the Set method instead.</pre>
Repository: go
Issue: proposal: spec: asymmetry between const and var conversions
Labels: LanguageChange,Proposal,LanguageChangeReview

<pre>This is not a request for a language change; I am just documenting a weakness of the
current const conversion rules: it confuses people that one can convert -1 to a uint,
but only if the -1 is stored in variable. That is,

var s = uint(-1)

is illegal: constant -1 overflows uint

That is clear, but it's also clear what I mean when I write this and it's a shame that I
can't express what I mean as a constant, especially since

var m = -1
var s = uint(m)

works. There is a clumsy workaround for this case, involving magic bit operations, but
the problem can turn up in other less avoidable ways:

const N int = 1234
const x int = N*1.5

fails yet

const N = 1234
const x int = N*1.5

succeeds. (Note the missing &quot;int&quot; in the declaration of N.) This can be
rewritten as

const x int = N*3/2

but if the floating point constant is itself named (as with the -1 in the uint example),
it becomes impossible to express the constant value in Go even though its value seems
clear.

Again, not asking for a change, just pointing out a clumsy result of the existing rules</pre>
Repository: go
Issue: cmd/cgo: gdb on darwin cannot find symbols for cgo compiled objects
Labels: Suggested,OS-Darwin

<pre>What steps will reproduce the problem?
1. Compile a program using Go 1.2 on Mac OS 10.9 that uses CGO.  Set CC = a version of
GCC from home brew - <a href="http://brew.sh">http://brew.sh</a>
2. Launch the program with gdb for debugging

What is the expected output?
gdb loads the symbols from the file and is able to step through the file

What do you see instead?
Following output from GDB:
GNU gdb (GDB) 7.6.2
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later &lt;<a href="http://gnu.org/licenses/gpl.html&gt">http://gnu.org/licenses/gpl.html&gt</a>;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type &quot;show copying&quot;
and &quot;show warranty&quot; for details.
This GDB was configured as &quot;x86_64-apple-darwin13.0.2&quot;.
For bug reporting instructions, please see:
&lt;<a href="http://www.gnu.org/software/gdb/bugs/&gt">http://www.gnu.org/software/gdb/bugs/&gt</a>;...
Reading symbols from /Users/lukemauldin/dev/goexternal/src/tf/vncclient/vncclient...
warning:
`/var/folders/d7/x2znfx9505gfcq8cr05c56nm0000gn/T/go-build264520081/tf/vncclient/vncrecord/_obj/_cgo_export.o':
can't open to read symbols: No such file or directory.

warning:
`/var/folders/d7/x2znfx9505gfcq8cr05c56nm0000gn/T/go-build264520081/tf/vncclient/vncrecord/_obj/vnccallback_c.o':
can't open to read symbols: No such file or directory.

warning:
`/var/folders/d7/x2znfx9505gfcq8cr05c56nm0000gn/T/go-build264520081/tf/vncclient/vncrecord/_obj/vncrecord.cgo2.o':
can't open to read symbols: No such file or directory.

warning:
`/var/folders/d7/x2znfx9505gfcq8cr05c56nm0000gn/T/go-build825245175/runtime/cgo/_obj/gcc_amd64.o':
can't open to read symbols: No such file or directory.

warning:
`/var/folders/d7/x2znfx9505gfcq8cr05c56nm0000gn/T/go-build825245175/runtime/cgo/_obj/gcc_darwin_amd64.o':
can't open to read symbols: No such file or directory.

warning:
`/var/folders/d7/x2znfx9505gfcq8cr05c56nm0000gn/T/go-build825245175/runtime/cgo/_obj/gcc_setenv.o':
can't open to read symbols: No such file or directory.

warning:
`/var/folders/d7/x2znfx9505gfcq8cr05c56nm0000gn/T/go-build825245175/runtime/cgo/_obj/gcc_util.o':
can't open to read symbols: No such file or directory.
(no debugging symbols found)...done.


Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Mac OS X 10.9

Which version are you using?  (run 'go version')
go version go1.2 darwin/amd64

Please provide any additional information below.
Debugging a program that does not directly use CGO works as expected.  GDB is able to
debug the same program on a Linux environment.</pre>
Repository: go
Issue: os, runtime: CTRL_CLOSE_EVENT should generate SIGHUP on Windows
Labels: Suggested,OS-Windows

<pre>On Windows, the CTRL_C_EVENT and CTRL_BREAK_EVENT control signals are converted to
SIGINT in the runtime package for Windows for use by the os/signal package. After some
investigation, I believe CTRL_CLOSE_EVENT should be emulated as SIGHUP. SIGHUP is
already invented for compatibility purposes in the syscall package, in the same way that
SIGINT is, and then actively used by the existing handlers installed for CTRL_C_EVENT
and CTRL_BREAK_EVENT above.

Relevant lines in tip's source:

runtime·stdcall(runtime·SetConsoleCtrlHandler, 2, runtime·ctrlhandler, (uintptr)1);
// This registers Go's control event handler to convert control events into unix-like
signals

/* in the handler these events are converted to SIGINT */
    case CTRL_C_EVENT:
    case CTRL_BREAK_EVENT:
        s = SIGINT;

/* invented values for important signals */
    SIGHUP  = Signal(0x1)
    SIGINT  = Signal(0x2)

Please also see:

<a href="http://stackoverflow.com/q/20511182/149482">http://stackoverflow.com/q/20511182/149482</a>
<a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms685049%28v=vs.85%29.aspx">http://msdn.microsoft.com/en-us/library/windows/desktop/ms685049%28v=vs.85%29.aspx</a>
<a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms683242(v=vs.85).aspx">http://msdn.microsoft.com/en-us/library/windows/desktop/ms683242(v=vs.85).aspx</a></pre>
Repository: go
Issue: cmd/gofmt: remove leading/trailing blank lines from function bodies
Labels: Thinking

<pre>What steps will reproduce the problem?

1. <a href="http://play.golang.org/p/Np4vGQFcqA">http://play.golang.org/p/Np4vGQFcqA</a>
2. Hit Format.


What is the expected output? What do you see instead?

Want: Lines 6 and 13 removed.
Have: No change.


Please use labels and text to provide additional information.

Discussed with the community in
<a href="https://groups.google.com/forum/#">https://groups.google.com/forum/#</a>!topic/golang-nuts/Z_s_tLTazJU

Based on that feedback, I propose that gofmt:

* remove trailing blank lines from function bodies
* remove leading blank lines when the function declaration is a single line

If this (or some variant thereof) gets an official blessing, I'd be happy to implement.</pre>
Repository: go
Issue: proposal: net/v2: receiving IPv4 header on raw IPv4 socket
Labels: v2,Proposal

<pre>// BUG(mikio): On every POSIX platform, reads from the &quot;ip4&quot; network
// using the ReadFrom or ReadFromIP method might not return a complete
// IPv4 packet, including its header, even if there is space
// available. This can occur even in cases where Read or ReadMsgIP
// could return a complete packet. For this reason, it is recommended
// that you do not uses these methods if it is important to receive a
// full packet.
//
// The Go 1 compatibility guidelines make it impossible for us to
// change the behavior of these methods; use Read or ReadMsgIP
// instead.</pre>
Repository: go
Issue: cmd/cgo: pointers of Objective-C classes compatibility
Labels: NeedsInvestigation

<pre>What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.

A pointer of an Objective-C class can't be assigned to a variable as a pointer of
another Objective-C class. For example:

package main

// #cgo CFLAGS: -x objective-c                                                          
                                                                                        
                                                                                        
     
//                                                                                      
                                                                                        
                                                                                        
     
// @class Foo;                                                                          
                                                                                        
                                                                                        
     
// @class Bar;                                                                          
                                                                                        
                                                                                        
     
import &quot;C&quot;

func main() {
        var foo *C.Foo
        var bar *C.Bar

        foo = bar // ?                                                                                                                                                                                                                                                          

        print(foo)
        print(bar)
}

What is the expected output?
Compile Error

What do you see instead?
Compile succeeded
(&quot;0x00x0&quot; was printed)

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Mac OS X 10.9

Which version are you using?  (run 'go version')
go version go1.2 darwin/amd64

Please provide any additional information below.</pre>
Repository: go
Issue: proposal: fmt/v2: State Flag(int) should be Flag(rune)
Labels: v2,Proposal

<pre>This issue is really just a note.

The Flag method of fmt.State takes an int argument but represents a 'character'.
Probably it should have been changed from int to rune when the rune alias was introduced
(or byte - given all flags are ASCII).

Which version are you using?  (run 'go version')

go1.2</pre>
Repository: go
Issue: x/playground: Maybe warn user if import of "time" or "net" is seen
Labels: help wanted

<pre>The playground just keeps confusing people. Here's an idea to make it's intentional
limitations more discoverable:

- add a content slot just before output, that is marked up with e.g.  background color
that differentiates it from output, that can contain messages; make it invisible if empty

- if the code imported &quot;time&quot;, add message like &quot;Playground is frozen in
time to 2009.&quot;

- if the code imported &quot;net&quot;, add message like &quot;Playground has fake
networking that can only communicate within the application.&quot; 

- if either of the two messages triggered, add a link &quot;See About for more.&quot;</pre>
Repository: go
Issue: runtime: runtime_test execution of nm uses system go, not go in tree
Labels: NeedsInvestigation

<pre>check out tree
cd go/src
./make.bash
../bin/go test runtime -short

--- FAIL: TestRuntimeGogoBytes (0.10 seconds)
    runtime_test.go:113: go tool nm: exit status 1
        usage: nm [-aghnsSTu] file ...
FAIL

It's picking up the system-wide go (and thus nm) which is Go 1.2, not the one from
../bin/go which is tip.

Setting GOROOT before building fixes it.  This used to work, although I guess mostly by
accident (the system and tip nm's were compatible).  Any way we can fix this, or do I
have to start setting GOROOT all the time now?</pre>
Repository: go
Issue: proposal: go/ast: deprecate MergePackageFiles (it's not used, and buggy)
Labels: Proposal

by **bgarcia@golang.org**:

<pre>The parser.ParseComments option to parser.ParseFile
causes ast.MergePackageFiles to create a broken merge.

What steps will reproduce the problem?
  This code reproduces the problem:
  <a href="http://play.golang.org/p/63LsxcrpWi">http://play.golang.org/p/63LsxcrpWi</a>
  You can also run godoc with --src option for a package with multiple source files, like strings.

What is the expected output?
  // Package foo does bar and baz.
  package foo

  type string struct{}

  // Foo is a structure.
  type Foo struct{}

  // String outputs Foo in a human-readable way.
  func (f *Foo) String() string { return string{} }

  // Error method for Foo.
  func (f *Foo) Error() string { return f.String() }


What do you see instead?
  package

  // Foo is a structure.
  foo

  type string struct{}

  type Foo struct{}

  // String outputs Foo in a human-readable way.

  // Package foo does bar and baz.

  // Error method for Foo.

  func (f *Foo) String() string { return string{} }

  func (f *Foo) Error() string { return f.String() }</pre>
Repository: go
Issue: net/http/cookiejar: figure out canonicalization resposibility
Labels: NeedsInvestigation

<pre>Nigel's comments on <a href="https://golang.org/cl/47560044/">https://golang.org/cl/47560044/</a> :

&quot;&quot;&quot;
OK, but this means that e.g., in the
code.google.com/p/go.net/publicsuffix implementation, it's perfectly
valid thatPublicSuffix(&quot;example.com.au&quot;) is &quot;com.au&quot; but
PublicSuffix(&quot;EXAMPLE.COM.AU&quot;) is &quot;AU&quot;.

What happens if, somewhere out there in the wild internet, a anchor's
href contains a domain in ALL.CAPS? A naive HTTP client implementation
might end up associating any returned cookies with the wrong public
suffix, unless somewhere along the line the domains are canonicalized to
lower case. Is this a cookie security problem, and a particularly
insidious one since it 'works' 99.999% of the time?

This particular CL says that the PublicSuffixList is not responsible for
canonicalization (lower-casing, punycode), but the bigger question of
who *is* responsible is left unanswered. Having different parts of a
program each do their own ad hoc canonicalization can be precarious,
e.g. if some separate part of the program then lower-cases the &quot;AU&quot; to
&quot;au&quot;. It's not exactly related to cookie jars, but I am reminded of
<a href="http://labs.spotify.com/2013/06/18/creative-usernames/">http://labs.spotify.com/2013/06/18/creative-usernames/</a>

Personally, I would not have removed the TODO without first building
consensus (presumably as a new discussion on golang-dev) about how to
approach domain canonicalization and cookies so that it's always right,
not just almost always right.
&quot;&quot;&quot;</pre>
Repository: go
Issue: x/net/ipv6: add support for windows
Labels: help wanted,OS-Windows,FeatureRequest

<pre>It might be easy on both dragonfly and solaris, but not sure whether plan9 is an ipv6
compliant implementation.</pre>
Repository: go
Issue: x/net/ipv4: add support for windows
Labels: help wanted,OS-Windows

<pre>For now they are full of shims and spacers.</pre>
Repository: go
Issue: go/printer: match indentation when returning multiple composite literals
Labels: Suggested

<pre><a href="http://play.golang.org/p/IxtYF1rXe9">http://play.golang.org/p/IxtYF1rXe9</a>
-----
package main

type T struct {
    x int
    y string
}

func f() (*T, *T) {
    return &amp;T{
            x: 1,
            y: &quot;foo&quot;,
        }, &amp;T{
            x: 2,
            y: &quot;bar&quot;,
        }
}
-----

This doesn't happen when there's only one return value, or when one of the return values
is &quot;nil&quot;.</pre>
Repository: go
Issue: go/printer: wonky alignment when mixing embedded and typed fields along with struct tags in a struct definition
Labels: NeedsInvestigation

by **cudmore.mb**:

<pre>*What steps will reproduce the problem?*
1. Format <a href="http://play.golang.org/p/jzmwwldMwt">http://play.golang.org/p/jzmwwldMwt</a>
2. Format 

*What is the expected output?*
{{{
type Field struct {
    ID       `json:&quot;UID&quot;` // comment
    Label ID `json:&quot;Lbl&quot;` // comment
    *N                    // comment

    Value string `json:&quot;Val&quot;`
    Inheritable  `json:&quot;Inh&quot;` // comment

    a int // comment
    b string
    c int // comment
}
}}}

*What do you see instead?*
{{{
type Field struct {
    ID    `json:&quot;UID&quot;` // comment
    Label ID           `json:&quot;Lbl&quot;` // comment
    *N                 // comment

    Value       string       `json:&quot;Val&quot;`
    Inheritable `json:&quot;Inh&quot;` // comment

    a int // comment
    b string
    c int // comment
}
}}}

*Which version are you using?*
go1.2

I opened a discussion on this here:
<a href="https://groups.google.com/d/topic/golang-nuts/5RlC11J7XNE/discussion">https://groups.google.com/d/topic/golang-nuts/5RlC11J7XNE/discussion</a>

It would be great if go fmt would align the parts of field definitions by kind (type,
tag, comment), rather than by index (first parts align, second parts), across contiguous
field definitions until an intermittent newline or comment.

The type of anonymous fields would be regarded as the field name, and would not
contribute to computing the alignment of the types. All types in a contiguous list of
fields would align to the rightmost, and then all tags, and then all comments.

However, this does get tricky: <a href="http://play.golang.org/p/Z_OPEbej-v">http://play.golang.org/p/Z_OPEbej-v</a></pre>
Repository: go
Issue: x/net/html: ParseFragment fails to parse sub-table elements in the root position
Labels: NeedsInvestigation

by **algorithmicimperative**:

<pre>1. Use `html.ParseFragment` to parse a fragment of HTML where the root elements are
`&lt;tbody&gt;`, `&lt;tr&gt;` or `&lt;td&gt;` (and probably other table sub-elements)

For example:

s := `&lt;td&gt;first&lt;/td&gt;
    &lt;td&gt;second&lt;/td&gt;
    &lt;td&gt;third&lt;/td&gt;
`
doc, err := html.ParseFragment(strings.NewReader(s), &amp;html.Node{
    Type: html.ElementNode,
    Data: &quot;body&quot;,
    DataAtom: atom.Body,
})


2. Check the result `fmt.Printf(&quot;%#v\n&quot;, doc)`


What is the expected output?

`[]*html.Node` of 3 `td` elements


What do you see instead?

`[]*html.Node` of a single text node containing the `first second third` text.


Which operating system are you using? Linux


Which version are you using?  1.2



ParseFragment works fine with other semantically incorrect structures, like
`&lt;option&gt;` elements. Has trouble with table sub-elements though.

If this isn't a bug and is failing by design, perhaps we need something like
`atom.DocumentFragment` that will receive any arbitrary HTML.</pre>
Repository: go
Issue: encoding/xml: omit parent tags if value is empty #2
Labels: NeedsFix,early-in-cycle

<pre>What steps will reproduce the problem?
<a href="http://play.golang.org/p/m2rU4cPOBo">http://play.golang.org/p/m2rU4cPOBo</a>

What is the expected output?
&lt;OmitEmpty&gt;&lt;/OmitEmpty&gt;

What do you see instead?
&lt;OmitEmpty&gt;&lt;Vars&gt;&lt;/Vars&gt;&lt;/OmitEmpty&gt;

Please provide any additional information below.
<a href="https://golang.org/cl/6569067/">https://golang.org/cl/6569067/</a>

This was originally: <a href="https://golang.org/issue/4168">https://golang.org/issue/4168</a>
Ran into this issue today making a restful API service. Ended up having to make my own
custom Marshaller.</pre>
Repository: go
Issue: cmd/cgo: doesn't properly recognize a typedef'd C array type when it's a const C function argument
Labels: Suggested

by **krzysiek@dajerade.pl**:

<pre>I ran into an issue with cgo, when integrating Go with some C code. The attached tarball
contains a minimal example that reproduces the problem. Basicaly, passing a variable of
a typedef'd array type to a function accepting a const argument results in a &quot;type
mismatch&quot; compilation error.

C:

typedef unsigned char Bar[12];

void foo(Bar* f); // this works
void foo2(const Bar* f); // this confuses cgo

Go:

func main() {
  var v C.Bar
  C.foo(&amp;bar) // this works
  C.foo2(&amp;bar) // error, pasted below
}

This doesn't happen on Mac OS, go version go1.2 darwin/amd64, I don't know about Windows
builds.

What steps will reproduce the problem?
1. tar zxf const-bug.tar.gz &amp;&amp; cd const-bug &amp;&amp; make

What is the expected output?
Program should compile.

What do you see instead?
src/kg/constbug/main.go:12: cannot use &amp;bar (type *_Ctype_Bar) as type
*[12]_Ctype_unsignedchar in function argument

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Ubuntu 12.04

Which version are you using?  (run 'go version')
go version go1.2 linux/amd64
Installed from <a href="https://go.googlecode.com/files/go1.2.linux-amd64.tar.gz">https://go.googlecode.com/files/go1.2.linux-amd64.tar.gz</a></pre>


Attachments:
1. <a href="https://storage.googleapis.com/go-attachment/7270/0/const-bug.tar.gz">const-bug.tar.gz</a> (1144 bytes)
Repository: go
Issue: cmd/asm: add neon, vector instructions for arm
Labels: NeedsFix

by **byron.rakitzis**:

<pre>go1.2

In contrast to the amd64 port, the arm port of the Go assembler does not recognize SIMD
instructions (&quot;V…&quot;) or vector registers (D or Q).

It would be useful for us (we are writing custom speedups for a project using Intel SSE,
and would care to do the same for ARM), but it would also be useful for the Go library
itself if the library functions which have SIMD speedups in xxx_amd64.s had analogous
speedups in xxx_arm.s

Thank you,

Byron Rakitzis.</pre>
Repository: go
Issue: misc/makerelase: wrong icon for Windows command prompt
Labels: help wanted,OS-Windows

by **golubdr**:

<pre>Installing Go on a Windows computer causes any 32-bit command prompt windows (opened by
running C:\Windows\SysWOW64\cmd.exe) to have the Go icon instead of the command prompt
icon.  A similar issue existed for the Windows version of Git and has already been fixed
there.  See <a href="https://github.com/msysgit/msysgit/issues/71">https://github.com/msysgit/msysgit/issues/71</a>.</pre>