Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: third_party/go/src/golang.org/x/mobile/bind/bind.go

Issue 1275153002: Remove third_party/golang.org/x/mobile as it is no longer used with Go 1.5. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Remove golang.org/x/mobile Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // Package bind implements a code generator for gobind.
6 //
7 // See the documentation on the gobind command for usage details.
8 package bind // import "golang.org/x/mobile/bind"
9
10 // TODO(crawshaw): slice support
11 // TODO(crawshaw): channel support
12
13 import (
14 "bytes"
15 "go/format"
16 "go/token"
17 "io"
18
19 "golang.org/x/tools/go/types"
20 )
21
22 // GenJava generates a Java API from a Go package.
23 func GenJava(w io.Writer, fset *token.FileSet, pkg *types.Package) error {
24 buf := new(bytes.Buffer)
25 g := &javaGen{
26 printer: &printer{buf: buf, indentEach: []byte(" ")},
27 fset: fset,
28 pkg: pkg,
29 }
30 if err := g.gen(); err != nil {
31 return err
32 }
33 _, err := io.Copy(w, buf)
34 return err
35 }
36
37 // GenGo generates a Go stub to support foreign language APIs.
38 func GenGo(w io.Writer, fset *token.FileSet, pkg *types.Package) error {
39 buf := new(bytes.Buffer)
40 g := &goGen{
41 printer: &printer{buf: buf, indentEach: []byte("\t")},
42 fset: fset,
43 pkg: pkg,
44 }
45 if err := g.gen(); err != nil {
46 return err
47 }
48 src := buf.Bytes()
49 srcf, err := format.Source(src)
50 if err != nil {
51 w.Write(src) // for debugging
52 return err
53 }
54 _, err = w.Write(srcf)
55 return err
56 }
OLDNEW
« no previous file with comments | « third_party/go/src/golang.org/x/mobile/audio/audio_test.go ('k') | third_party/go/src/golang.org/x/mobile/bind/bind_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698