// error type
s = lookup("error");
s->lexical = LNAME;
- errortype = t;
- errortype->sym = s;
s1 = pkglookup("error", builtinpkg);
+ errortype = t;
+ errortype->sym = s1;
s1->lexical = LNAME;
s1->def = typenod(errortype);
// byte alias
s = lookup("byte");
s->lexical = LNAME;
- bytetype = typ(TUINT8);
- bytetype->sym = s;
s1 = pkglookup("byte", builtinpkg);
+ bytetype = typ(TUINT8);
+ bytetype->sym = s1;
s1->lexical = LNAME;
s1->def = typenod(bytetype);
// rune alias
s = lookup("rune");
s->lexical = LNAME;
- runetype = typ(TINT32);
- runetype->sym = s;
s1 = pkglookup("rune", builtinpkg);
+ runetype = typ(TINT32);
+ runetype->sym = s1;
s1->lexical = LNAME;
s1->def = typenod(runetype);
}
type Foo struct {
int
+ int8
+ error
+ rune
+ byte
}
var x a.Foo
func main() {
- x.int = 20 // ERROR "unexported field"
+ x.int = 20 // ERROR "unexported field"
+ x.int8 = 20 // ERROR "unexported field"
+ x.error = nil // ERROR "unexported field"
+ x.rune = 'a' // ERROR "unexported field"
+ x.byte = 20 // ERROR "unexported field"
}
-
+// Copyright 2013 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 a
type Package struct {
type Future struct {
result chan struct {
*Package
+ error
}
}
-func (t *Future) Result() *Package {
+func (t *Future) Result() (*Package, error) {
result := <-t.result
t.result <- result
- return result.Package
+ return result.Package, result.error
}
+// Copyright 2013 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
import "a"