Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/gofmt: silently turns invalid program into a valid one (full slice expression) #7305

cznic opened this issue Feb 11, 2014 · 3 comments


Copy link

@cznic cznic commented Feb 11, 2014

What steps will reproduce the problem?

1. Have an invalid program (does not compile):
package main //

func main() {
        _ = []int{}[0:0:] // <- missing mandatory max

2. Click the "Format" button.

3. Click the "Run" button

What is the expected output?
prog.go:4: final index required in 3-index slice
 [process exited with non-zero status]

What do you see instead?
[no output]

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

Which operating system are you using?

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

Please provide any additional information below.
The semantics of [l:h] and [l:h:m] differs enough to possibly get any/undefined behavior
from the new "valid" code.
Copy link

@bradfitz bradfitz commented Feb 11, 2014

Comment 1:

Nice find.

Labels changed: added release-go1.3, repo-main.

Owner changed to @griesemer.

Status changed to Accepted.

Copy link

@griesemer griesemer commented Feb 11, 2014

Comment 2:

Status changed to Started.

Copy link

@griesemer griesemer commented Feb 11, 2014

Comment 3:

This issue was closed by revision 13a5958.

Status changed to Fixed.

@cznic cznic added fixed labels Feb 11, 2014
@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.