sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: go
Issue: cmd/compile: rethink temporary names
Labels: NeedsInvestigation

<pre>package p

func conv() {
    var f float64
    _ = float64(uint64(f))
}

go version devel +b0443478e712 Thu May 01 16:29:34 2014 -0400 darwin/386

go tool 8g -S conv.go

The assembly listing includes:

    0x00b7 00183 (conv.go:5)    FMOVDP  F0,&quot;&quot;.autotmp_0001+20(SP)
    0x00bb 00187 (conv.go:5)    JMP ,130
    0x00bd 00189 (conv.go:5)    FSTCW   ,&quot;&quot;..utotmp_0004+2(SP)
    0x00c1 00193 (conv.go:5)    MOVW    $3967,&quot;&quot;..utotmp_0005+0(SP)
    0x00c7 00199 (conv.go:5)    FLDCW   &quot;&quot;..utotmp_0005+0(SP),
    0x00ca 00202 (conv.go:5)    FMOVD   $f64.43e0000000000000+0(SB),F0
    0x00d0 00208 (conv.go:5)    FUCOMIP F0,F1
    0x00d2 00210 (conv.go:5)    JLS ,225
    0x00d4 00212 (conv.go:5)    FMOVVP  F0,&quot;&quot;.autotmp_0003+12(SP)
    0x00d8 00216 (conv.go:5)    FLDCW   &quot;&quot;..utotmp_0004+2(SP),

Note the variable names &quot;&quot;..utotmp_0004 and &quot;&quot;..utotmp_0005. There
is downstream code that checks for the &quot;autotmp&quot; prefix, so this name
corruption is potentially significant. Not all autotmp names are corrupted (see
&quot;&quot;.autotmp_0001).

I've not seen name corruption with either 5g or 6g.</pre>
Repository: go
Issue: runtime: improve goroutine profiler
Labels: NeedsInvestigation

<pre>Some concrete suggestions:
1. Add goroutine state (waiting, runnable, syscall) as comment in debug more and/or as
top frame (so that all waiting goroutines converge in a single &quot;Waiting&quot; block
in svg graph.
2. Add &quot;created by&quot; line in debug mode.
3. Dedup stacks, there can be thousands of equal stacks.</pre>
Repository: go
Issue: x/net/html: Tokenizer cannot round-trip <script> tag contents
Labels: NeedsInvestigation

by **martin@probst.io**:

<pre>I'm not sure if this is a bug or working as intended according to the HTML5 parsing
algorithm, but it seems at least problematic from a user's perspective.

When parsing an HTML document that contains &lt;script&gt; tags, writing out the tokens
received will double escape any contained entities, thus &lt;script&gt; tags don't
round-trip through the tokenizer. See the attached patch which adds two tests for
&lt;script&gt;&quot;&lt;/script&gt; (which leads to &amp;#24; as the contents) and
&lt;script&gt;&amp;#34;&lt;/script&gt;, which leads to &amp;amp;#34;.

That means re-parsing the output of tokenization adds more and more double escaping.

There is a test for &lt;style&gt; just below the one I added that makes this look
intentional. But this is a real problem: using go.net/html to parse and re-serialize
documents breaks the documents.</pre>


Attachments:
1. <a href="https://storage.googleapis.com/go-attachment/7929/0/script_tags_test.diff">script_tags_test.diff</a> (494 bytes)
Repository: go
Issue: x/crypto/ssh/terminal: does not handle interruptions
Labels: NeedsInvestigation

by **monikan@google.com**:

<pre>go.crypto/ssh/terminal does not handle interruptions. 

Instead of ignoring an interruption terminal should return with error allowing the
caller to handle interruption e.g. restore terminal state before exiting.</pre>
Repository: go
Issue: crypto/tls: tls.Dial get error  "local error: unexpected message"
Labels: NeedsInvestigation

by **webluoye**:

<pre>What does 'go version' print?
go version go1.2.1 linux/amd64

What steps reproduce the problem?

If possible, include a link to a program on play.golang.org.
cert, err := tls.LoadX509KeyPair(&quot;eeee.crt&quot;, &quot;eeee.pem&quot;)
if err != nil {
    log.Fatalf(&quot;server: loadkeys: %s&quot;, err)
}
config := tls.Config{Certificates:
[]tls.Certificate{cert},ClientAuth:tls.VerifyClientCertIfGiven,InsecureSkipVerify: true}
conn, err := tls.Dial(&quot;tcp&quot;, &quot;218.241.106.8:4121&quot;, &amp;config)
if err != nil {
    log.Fatalf(&quot;client DialTCP: %s&quot;, err)
}


What happened?
tls.Dial get error message &quot;client DialTCP: local error: unexpected message&quot;

What should have happened instead?
it can connect use eeee.pem and eeee.crt via openssl

Please provide any additional information below.
openssl s_client -connect 218.241.106.8:4121 -cert eeee.crt -key eeee.pem -state
-showcerts

---
SSL handshake has read 19310 bytes and written 1018 bytes

---
New, TLSv1/SSLv3, Cipher is EDH-RSA-DES-CBC3-SHA
Server public key is 1024 bit
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
SSL-Session:
    Protocol  : TLSv1
    Cipher    : EDH-RSA-DES-CBC3-SHA
    Session-ID: 536B3891C89AACE7E71ACF2D6F3D9D8A723025CD1711863FE075C24F278B7F8D
    Session-ID-ctx: 
    Master-Key: E895BA788756B389744916D6790AD116CF6B669B2242C880791FAF049D9D22183F1750A2CE60BEFA108B79938007B566
    Key-Arg   : None
    Krb5 Principal: None
    PSK identity: None
    PSK identity hint: None
    Start Time: 1399535765
    Timeout   : 300 (sec)
    Verify return code: 18 (self signed certificate)

---
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;
standalone=&quot;no&quot;?&gt;</pre>
Repository: go
Issue: x/tools/cmd/present: poor experience on Android Chrome
Labels: Suggested

by **bgarcia@golang.org**:

<pre>When trying to view a &quot;present&quot; slide deck (e.g.
<a href="http://talks.golang.org/2014/c2go.slide)">http://talks.golang.org/2014/c2go.slide)</a>, chrome on android attempts to do some
auto-resizing so that three slides are all completely viewable.  This makes the slides
very small, and puts a large blank area below the slides.

If I attempt to resize the page (via the two-finger resize gesture), I can attempt to
fix this.  But eventually, while swiping the slides left or right, I'll hit the
beginning or end of the deck, and either the slide will be resized, or the current slide
will be partially off-screen.</pre>
Repository: go
Issue: spec: Go spec method expressions/values - tidy up
Labels: Documentation,NeedsInvestigation

by **xunfin**:

<pre>As per note at Golang Nuts

<a href="https://groups.google.com/forum/#">https://groups.google.com/forum/#</a>!topic/golang-nuts/6ltLyMGuAS8

The two sections <a href="http://golang.org/ref/spec#Method_expressions">http://golang.org/ref/spec#Method_expressions</a> and
<a href="http://golang.org/ref/spec#Method_values">http://golang.org/ref/spec#Method_values</a> are a little verbose (much more than a full
verticle screen each - in contrast to most/all other sections in spec) and maybe have
too many examples.

I suggested that stating

 &quot;if t is a variable of type T and M(x) is in the method set of T then:

  T.M(t,x) is the same as t.M(x)&quot;

Could help in clarifying (see original post)

There is no issue with behaviour or specification - just length/clarity of text.</pre>
Repository: go
Issue: x/arch/x86/x86asm: Mem.Disp is positive for negative displacements
Labels: NeedsInvestigation

<pre>The instruction 48 8b 0c 25 c0 5c 07 80 is disassembled as MOVQ 0x80075cc0, CX. It
should be disassembled as MOVQ 0xffffffff80075cc0, CX. Addresses are signed, and should
be sign-extended. See the discussion in <a href="https://golang.org/issue/7980">issue #7980</a> for details.

To reproduce, run 'go tool objdump addr31 0x2000 0x2012'. addr31 is attached. It was
created by stripping a binary built from the code in <a href="https://golang.org/issue/7980">issue #7980</a>.</pre>


Attachments:
1. <a href="https://storage.googleapis.com/go-attachment/8000/0/addr31.gz">addr31.gz</a> (153196 bytes)
Repository: go
Issue: image: decode / resize into an existing buffer
Labels: Thinking

<pre>The image/foo packages currently provide foo.Decode functions that allocate a new image
buffer. It would be nice, especially when decoding a moving image, to decode into an
existing buffer.

Also, it would be nice to be able to resize an image during (and not after) decoding,
which can obviously allocate a smaller buffer but can also be faster. Apparently
Imagemagick can do this for JPEGs, and
<a href="https://groups.google.com/forum/#">https://groups.google.com/forum/#</a>!topic/golang-nuts/13Gr_AmBAKY claims a 50% speedup for
generating a thumbnail.

The two concerns are superficially separate, but the API (if any) to do this should
probably consider both use cases.</pre>
Repository: go
Issue: encoding/xml: empty namespace prefix definitions should be illegal
Labels: NeedsInvestigation

<pre>What does 'go version' print?
go version go1.2 linux/amd64


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

What happened?
No-error.

What should have happened instead?
Should generate an error.

Per <a href="http://www.w3.org/TR/REC-xml-names/#dt-prefix">http://www.w3.org/TR/REC-xml-names/#dt-prefix</a> a prefix must refer to a namespace
name, not the empty string. 

Please provide any additional information below.

Ran into this in implementing webdav, the litmus tests test this error condition [and
due to xml.Token hiding prefixing it is impossible to detect otherwise]</pre>
Repository: go
Issue: crypto/tls: a timeout error on tls.Conn.Write is confusing
Labels: NeedsDecision

<pre>SetWriteDeadline of tls.Conn describes &quot;A zero value for t means Write will not
time out. After a Write has timed out, the TLS state is corrupt and all future writes
will return the same error.&quot; but the returned value on timeout is marked Temporary
and it may be confusing.

A suggestion: <a href="https://groups.google.com/d/msg/golang-nuts/UChb8wv6gvA/9R_g4ScTMiYJ">https://groups.google.com/d/msg/golang-nuts/UChb8wv6gvA/9R_g4ScTMiYJ</a></pre>
Repository: go
Issue: proposal: spec: represent interfaces by their definition and not by package and name
Labels: LanguageChange,Proposal,LanguageChangeReview

<pre>An interface is a collection of method names and signatures.

Say, we have:

package a

type Writer interface {
    Write([]byte) (int, error)
}


type WriterTo interface {
     WriteTo(Writer) (int64, error)
}

type WriterTo2 interface {
    WriteTo(w interface{Write([]byte) (int, error)} (int64, error)
}


From the perspective of the one writing an implementation, the a.Writer
and io.Writer are the same: As long as the Write method has the right
signature they are both fulfilled. 

However a.WriterTo and io.WriterTo are not, simply because they refer
to Writers of different packages although they have the same definition. Even WriterTo2
would only be compatible with io.WriterTo if
they later had an anonymous interface too.

see <a href="http://play.golang.org/p/kOH11TOlsE">http://play.golang.org/p/kOH11TOlsE</a>

Since interfaces are all about reusable code this behaviour must be 
considered an artifact of the way, interfaces are represented and treated during
compilation.

Since interfaces have no methods and no values, their only value is to help the
programmers via the type constraints. 

From the implementation perspective a.WriterTo, io.WriterTo and a.WriterTo2 must be
treated as being the same, a contraint to have a method WriteTo(w
interface{Write([]byte) (int, error)} (int64, error).

The names (and packages) of the interfaces should not be relevant for the compiler.
Instead the definition should be the representation and the names just shortcuts to
refer to them.</pre>
Repository: go
Issue: cmd/gofmt: gofmt doesn't ignore directories prefixed with _
Labels: Thinking

by **onsi@pivotallabs.com**:

<pre>go test ./... ignores directories prefixed with _.  This is convenient and seems like a
reasonable rule of thumb.

gofmt -w . 

does *not* honor this &quot;rule&quot;

With the ascendance of Godeps there are now Godeps/_workspace folders vendoring
dependencies all over the place.  Having gofmt -w . rewrite my dependencies is painful. 
Any change the &quot;ignore _&quot; rule could be ported over to gofmt sometime soon? 
Would be happy to work on a pull request for this.</pre>
Repository: go
Issue: cmd/compile: report all missing methods on failed interface satisfaction
Labels: NeedsInvestigation

<pre>If a type does not implement an interface, the compiler currently only reports one
error. It would be nice if it reported more errors.

<a href="http://play.golang.org/p/ayvTDLAJiZ">http://play.golang.org/p/ayvTDLAJiZ</a></pre>
Repository: go
Issue: cmd/compile: does not understand old linker flags
Labels: NeedsInvestigation

<pre>liblink/obj6.c uses ctxt-&gt;debugstack to emit stack underflow checks. The flag was
meant to be initialized from -K 6l flag.
But now liblink is invoked from the compiler. And the compiler does not initialize
ctxt-&gt;debugstack. Moreover the compiler already uses -K flag for a different purpose.

I suspect this relates to a bunch of other flags as well.
We need to choose some other names for the old linker flags and read them in all users
of liblink.</pre>
Repository: go
Issue: cmd/cgo: Allow C code to use structures defined in Go
Labels: NeedsInvestigation

by **fuzxxl**:

<pre>There are some C structures that cannot be correctly accessed from Go code as Go does
not provide the features needed to access them. Examples are unions, bitfields and
structures that are affected by issue #7560. Therefore, C code is needed to unmarshall
and marshall these structures into Go code.

Sadly, this is very uggly to do right now as there seems to be no sane way of having a C
function operate on types defined in Go code. Right now, I have to define the structure
I'm marshalling into on the C side of code which requires me to marshall the already
marshalled structure again if I want to provide that structure as an interface to other
packages.

Ideally, something like this is possible:

package example

/*
#include &quot;go.h&quot;

// struct I want to marshall
struct something {
    // ...
}

void marshall_something(struct something *s, GoSomething *g) {
    // unmarshall s into g
}
*/
import &quot;C&quot;

//export
type something struct {
    // corresponding Go type that is visible to C
    // ...
}</pre>
Repository: go
Issue: encoding/xml: disallow attributes named xmlns:*
Labels: NeedsFix,early-in-cycle

by **opennota**:

<pre>The Encoder will add namespaced to the elements, even if there are the same namespaces
in the parent element:
<a href="http://play.golang.org/p/LDRJCxUJHX">http://play.golang.org/p/LDRJCxUJHX</a>

// Output:
// &lt;p xmlns=&quot;<a href="http://www.gribuser.ru/xml/fictionbook/2.0&quot">http://www.gribuser.ru/xml/fictionbook/2.0&quot</a>;
xmlns:l=&quot;<a href="http://www.w3.org/1999/xlink&quot">http://www.w3.org/1999/xlink&quot</a>;&gt;&lt;a
xmlns=&quot;<a href="http://www.gribuser.ru/xml/fictionbook/2.0&quot">http://www.gribuser.ru/xml/fictionbook/2.0&quot</a>;
xmlns:xlink=&quot;<a href="http://www.w3.org/1999/xlink&quot">http://www.w3.org/1999/xlink&quot</a>;
xlink:href=&quot;<a href="http://google.com&quot">http://google.com&quot</a>;&gt;google.com&lt;/a&gt;&lt;/p&gt;

I expect it to not repeat the namespaces:

// &lt;p xmlns=&quot;<a href="http://www.gribuser.ru/xml/fictionbook/2.0&quot">http://www.gribuser.ru/xml/fictionbook/2.0&quot</a>;
xmlns:l=&quot;<a href="http://www.w3.org/1999/xlink&quot">http://www.w3.org/1999/xlink&quot</a>;&gt;&lt;a
l:href=&quot;<a href="http://google.com&quot">http://google.com&quot</a>;&gt;google.com&lt;/a&gt;&lt;/p&gt;</pre>
Repository: go
Issue: cmd/vet: check for verb errors for fmt.Scanf
Labels: Analysis

<pre>What does 'go version' print?
go version go1.2.2 linux/amd64

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

1. Printf(&quot;test %d&quot;, f) where f is float is deemed a type error
2. Scanf(&quot;test %d&quot;, f) where f is float passes all type checking
3. <a href="http://play.golang.org/p/3OkpJ-RQeU">http://play.golang.org/p/3OkpJ-RQeU</a>
4. code sample will compile and pass go vet but fail at runtime

What happened?
Simple demo program using fmt.Scanf compiles  and passes go vet check but error found at
runtime.  Analogous program using fmt.Printf with same error does not pass go vet check.

What should have happened instead?
go vet should produce similar checks in fmt.Scanf as is does for fmt.Printf

Please provide any additional information below.</pre>
Repository: go
Issue: cmd/vet: handle embedded fields in structtags check
Labels: Analysis

<pre>The change at <a href="https://code.google.com/p/go/source/detail?r=dfa149f4c2fc&amp">https://code.google.com/p/go/source/detail?r=dfa149f4c2fc&amp</a>;repo=tools
may need to be updated after <a href="https://golang.org/issue/7363">issue #7363</a> is resolved.

Marking Go1.4 to match <a href="https://golang.org/issue/7363">issue #7363</a>.</pre>
Repository: go
Issue: os: TestGetppid fails on plan9
Labels: OS-Plan9,NeedsInvestigation

<pre>--- FAIL: TestGetppid (0.02 seconds)
    os_test.go:1318: Child process reports parent process id '0', expected '917122'

Alex</pre>
Repository: go
Issue: cmd/vet: No warning for some statements with no effect
Labels: Analysis

by **tmadams@google.com**:

<pre>What does 'go version' print?

go version go1.2 linux/amd64


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

In this toy example (which represents a pattern of bugs that crops up fairly frequently
for our team), I have forgotten to make err a named return value in my deferred
function. The intent was to propagate any error that occurred during execution of the
deffered function, but since I forgot to make err a named return value, the error gets
dropped.

<a href="http://play.golang.org/p/MD8tetH4ZI">http://play.golang.org/p/MD8tetH4ZI</a>


What happened?

The program compiled and ran without error.


What should have happened instead?

The compiler should have errored that the statement &quot;err = e&quot; had no effect.
Bonus points if it suggested that I might have meant to use a named return value.</pre>
Repository: go
Issue: gdb: Wrong values for local variables 
Labels: NeedsInvestigation

by **andreas.nusser**:

<pre>What does 'go version' print?
Tried with 
.)go version go1.3 linux/amd64
and
.)go version devel +e0ad7e329637 Thu Jun 19 22:19:56 2014 -0700 linux/amd64

As gdb I'm using &quot;GNU gdb (GDB) 7.6.2 (Debian 7.6.2-1.1+b1)&quot;

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

1. Write a short test program similar to the one attached. (You can find it here too:
<a href="http://play.golang.org./p/Y5b-t2iobd)">http://play.golang.org./p/Y5b-t2iobd)</a>
2. Compile it with go build -gcflags &quot;-N -l&quot; to prevent inlining
3. Run the resulting binary with gdb and observe as gdb reports wrong values for the
local variables. It even doesn't report the changed value of &quot;z&quot; in line 13.

What happened?
 - Instead of the values of the variables, gdb shows garbage.

What should have happened instead?
 - gdb should show the correct values.

Thanks for your help!
Andreas</pre>


Attachments:
1. <a href="https://storage.googleapis.com/go-attachment/8256/0/gdb_fail.go">gdb_fail.go</a> (276 bytes)
Repository: go
Issue: sync: per-cpu storage
Labels: Thinking

<pre>Provide a way to create/access cpu local objects. This may make it easy to  batch data
per-CPU to reduce global locking. This is a feature request.

Potential use case:

scalable stats across many goroutines - stat updates are batched in the per-CPU stat
object. Periodically or on-demand, the stat batches are aggregated to a global stat
object. 

This is similar to sync.Pool in that it will help reducing lock contention, but
different in that the object lifetime should be explicit and the per-CPU objects need to
be accessible from other CPUs if necessary.</pre>
Repository: go
Issue: spec: unspecified or unclear behavior for arithmetic operators on named types
Labels: NeedsInvestigation

by **arnaud.porterie**:

<pre>It seems that the following code is not fully specified:

  type MyType int
  [...]
  var m MyType
  m += 0

I understand that 0 being an untype constant, it can be used in a binary operation with
a `MyType` operand. However, I cannot find what specifies that binary operations can be
used on operands of type `MyType` (&quot;Arithmetic operators&quot; paragraph isn't
really clear on that).</pre>
Repository: go
Issue: net: Checking errors for EPIPE and ECONNRESET requires syscall
Labels: Thinking

<pre>Reading and writing can cause EPIPE and ECONNRESET to be returned in addition to io.EOF.

_, err := conn.Write(data)
if oe, ok := err.(*net.OpError); ok &amp;&amp; (oe.Err == syscall.EPIPE || oe.Err ==
syscall.ECONNRESET) {
    return fmt.Errorf(&quot;Connection closed&quot;)
}

_, err := conn.Read(data)
oe, ok := err.(*net.OpError)
if err == io.EOF || ok &amp;&amp; oe.Err == syscall.ECONNRESET {
    return fmt.Errorf(&quot;Connection closed&quot;)
}

This isn't the neatest solution, and if we're going to freeze and possibly internalize
syscall, this is going to have to go.

Perhaps something similar to os.IsExist? I'm thinking net.IsReset or net.IsClosed.

Or we could simply return io.EOF for both. I don't know.

And what about other operating systems? Do they have similar problems?</pre>
Repository: go
Issue: x/net/tcp: provide a way to set keepalive time and interval separately
Labels: NeedsInvestigation

by **redforks**:

<pre>func setKeepAlivePeriod() in net/tcpsockopt_unix.go is the back end of
TCPConn.SetKeepAlivePeriod() on linux platform. It set both TCP_KEEPINTVL and
TCP_KEEPIDLE to the period passed in:

func setKeepAlivePeriod(fd *netFD, d time.Duration) error {
    if err := fd.incref(); err != nil {
        return err
    }
    defer fd.decref()

    // The kernel expects seconds so round to next highest second.
    d += (time.Second - time.Nanosecond)
    secs := int(d.Seconds())

    err := os.NewSyscallError(&quot;setsockopt&quot;, syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_TCP, syscall.TCP_KEEPINTVL, secs))
    if err != nil {
        return err
    }
    return os.NewSyscallError(&quot;setsockopt&quot;, syscall.SetsockoptInt(fd.sysfd, syscall.IPPROTO_TCP, syscall.TCP_KEEPIDLE, secs))
}

Linux has three socket option affects keep alive:

  tcp_keepalive_time

 the interval between the last data packet sent (simple ACKs are not considered data) and the first keepalive probe; after the connection is marked to need keepalive, this counter is not used any further

tcp_keepalive_intvl

 the interval between subsequential keepalive probes, regardless of what the connection has exchanged in the meantime

tcp_keepalive_probes

 the number of unacknowledged probes to send before considering the connection dead and notifying the application layer

If I am not wrong, first kernel waits for TCP_KEEPIDLE seconds than send a keep alive
package (first probe), if not receive response from peer, wait TCP_KEEPINTVL seconds
send keep alive package again until TCP_KEEPCNT times, then close the tcp connection.

Linux default parameters is:
  TCP_KEEPIDLE: 7200 // 2 hours
  TCP_KEEPINTVL: 75 // 75 seconds
  TCP_KEEPCNT: 9 // try 9 times
So default a connection will closed after 7200+75*9 seconds, about 2 hours and 11
minutes.

Set both TCP_KEEPINTVL and TCP_KEEPIDLE to the same value normally is not we want. Such
as:

  conn.SetKeepAlivePeriod(time.Hour)

The actual effect is: 1 hour + 9 hour, after 10 hours kernel close the connection, it is
much longer than OS default settings.

I guess for compatible reason, SetKeepAlivePeriod() can not support all the three
parameters that linux use, but at least not set TCP_KEEPINTVL.</pre>
Repository: go
Issue: cmd/vet: add hook for file level checker short-circuits
Labels: Performance,Analysis

<pre>Some vet checks could be short-circuited at the file level. For example, the unsafe
pointer checker could avoid running if unsafe has not been imported. Something similar
holds for the atomic check, the cyclic finalizer test, and the template check (if it
goes in). The asm check could probably be run only on .s files.</pre>