My favorites | Sign in
go
Project Home Downloads Wiki Issues Source
Repository:
Checkout   Browse   Changes   Clones    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// errorcheck

// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

type S struct {
a int
}
type PS *S

func (p *S) get() int {
return p.a
}

func fn(p PS) int {
// p has type PS, and PS has no methods.
// (a compiler might see that p is a pointer
// and go looking in S without noticing PS.)
return p.get() // ERROR "undefined"
}
func main() {
s := S{1}
if s.get() != 1 {
panic("fail")
}
}

Change log

8ff8ddde157e by Russ Cox <r...@golang.org> on Feb 16, 2012   Diff
test: use testlib (second 100)

X ,s;^// \$G (\$D/)?\$F\.go *$;//
compile;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L
\$F\.\$A *$;// build;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L
\$F\.\$A && \./\$A\.out *$;// run;g
X ,s;^// errchk \$G( -e)? (\$D/)?\$F\.go
*$;// errorcheck;g

R=golang-dev
...
Go to: 

Older revisions

731aeabbce55 by Russ Cox <r...@golang.org> on Mar 30, 2010   Diff
single argument panic

note that sortmain.go has been run
through hg gofmt;
only the formatting of the day
...
373a2cd62e04 by Rob Pike <r...@golang.org> on Aug 17, 2009   Diff
fix up some irregular indentation

R=rsc
OCL=33382
CL=33391
e81ffb635205 by Ian Lance Taylor <i...@golang.org> on May 19, 2009   Diff
Match gccgo error messages.

 bug117 .go:13:12: error: reference to
undefined field or method

...
All revisions of this file

File info

Size: 523 bytes, 29 lines
Powered by Google Project Hosting