Gofmt to update doc comments to the new formatting.

For golang/go#51082.

Change-Id: I9b4c287e2d25aa108adfa9fe2f972c8fd3d68fe1
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/399597
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
This commit is contained in:
Russ Cox 2022-04-11 13:11:08 -04:00 коммит произвёл Gopher Robot
Родитель e579adbbc4
Коммит ce6a79cf6a
22 изменённых файлов: 147 добавлений и 133 удалений

Просмотреть файл

@ -240,6 +240,7 @@ func convRune(r rune) rune {
// into the standard keycodes used by the key package.
//
// To get a sense of the key map, see the diagram on
//
// http://boredzo.org/blog/archives/2007-05-22/virtual-key-codes
func convVirtualKeyCode(vkcode uint16) key.Code {
switch vkcode {

Просмотреть файл

@ -18,7 +18,7 @@ OpenGL, audio, and other Android NDK-like APIs. An all-Go app should
use this app package to initialize the app, manage its lifecycle, and
receive events.
Building apps
# Building apps
Apps written entirely in Go have a main function, and can be built
with `gomobile build`, which directly produces runnable output for
@ -30,7 +30,7 @@ https://golang.org/x/mobile/cmd/gomobile.
For detailed instructions and documentation, see
https://golang.org/wiki/Mobile.
Event processing in Native Apps
# Event processing in Native Apps
The Go runtime is initialized on Android when NativeActivity onCreate is
called, and on iOS when the process starts. In both cases, Go init functions
@ -74,12 +74,15 @@ packages:
- golang.org/x/mobile/event/paint
- golang.org/x/mobile/event/size
- golang.org/x/mobile/event/touch
For example, touch.Event is the type that represents touch events. Other
packages may define their own events, and send them on an app's event channel.
Other packages can also register event filters, e.g. to manage resources in
response to lifecycle events. Such packages should call:
app.RegisterFilter(etc)
in an init function inside that package.
*/
package app // import "golang.org/x/mobile/app"

Просмотреть файл

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build android && (arm || 386 || amd64 || arm64)
// +build android
// +build arm 386 amd64 arm64

1
bind/testdata/testpkg/tagged.go поставляемый
Просмотреть файл

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build aaa && bbb
// +build aaa,bbb
// This file tests that tags work with gomobile.

Просмотреть файл

@ -11,7 +11,7 @@ generated and automatically packaged for Android or iOS by
`gomobile bind`. For more details on installing and using the gomobile
tool, see https://golang.org/x/mobile/cmd/gomobile.
Binding Go
# Binding Go
Gobind generates target language (Java or Objective-C) bindings for
each exported symbol in a Go package. The Go package you choose to
@ -24,7 +24,7 @@ package can then be _ imported into a Go program, typically built
with -buildmode=c-archive for iOS or -buildmode=c-shared for Android.
These details are handled by the `gomobile bind` command.
Passing Go objects to target languages
# Passing Go objects to target languages
Consider a type for counting:
@ -85,7 +85,7 @@ The equivalent of calling newCounter in Go is GoMypkgNewCounter in Objective-C.
The returned GoMypkgCounter* holds a reference to an underlying Go
*Counter.
Passing target language objects to Go
# Passing target language objects to Go
For a Go interface:
@ -125,7 +125,6 @@ The Java implementation can be used like so:
Printer printer = new SysPrint();
Myfmt.printHello(printer);
For Objective-C binding, gobind generates a protocol that declares
methods corresponding to Go interface's methods.
@ -154,8 +153,7 @@ The Objective-C implementation can be used like so:
SysPrint* printer = [[SysPrint alloc] init];
GoMyfmtPrintHello(printer);
Type restrictions
# Type restrictions
At present, only a subset of Go types are supported.
@ -190,8 +188,7 @@ Go types, but this is a work in progress.
Exceptions and panics are not yet supported. If either pass a language
boundary, the program will exit.
Reverse bindings
# Reverse bindings
Gobind also supports accessing API from Java or Objective C from Go.
Similar to how Cgo supports the magic "C" import, gobind recognizes
@ -225,7 +222,7 @@ For more details on binding the the native API, see the design proposals,
https://golang.org/issues/16876 (Java) and https://golang.org/issues/17102
(Objective C).
Avoid reference cycles
# Avoid reference cycles
The language bindings maintain a reference to each object that has been
proxied. When a proxy object becomes unreachable, its finalizer reports
@ -246,7 +243,7 @@ We recommend that implementations of foreign interfaces do not hold
references to proxies of objects. That is: if you implement a Go
interface in Java, do not store an instance of Seq.Object inside it.
Further reading
# Further reading
Examples can be found in http://golang.org/x/mobile/example.

Просмотреть файл

@ -354,6 +354,7 @@ func goModTidyAt(at string, env []string) error {
// parseBuildTarget parses buildTarget into 1 or more platforms and architectures.
// Returns an error if buildTarget contains invalid input.
// Example valid target strings:
//
// android
// android/arm64,android/386,android/amd64
// ios,iossimulator,maccatalyst

Просмотреть файл

@ -30,8 +30,7 @@ Commands:
Use 'gomobile help [command]' for more information about that command.
Build a library for Android and iOS
# Build a library for Android and iOS
Usage:
@ -76,8 +75,7 @@ The -v flag provides verbose output, including the list of packages built.
The build flags -a, -n, -x, -gcflags, -ldflags, -tags, -trimpath, and -work
are shared with the build command. For documentation, see 'go help build'.
Compile android APK and iOS app
# Compile android APK and iOS app
Usage:
@ -128,15 +126,13 @@ The -v flag provides verbose output, including the list of packages built.
The build flags -a, -i, -n, -x, -gcflags, -ldflags, -tags, -trimpath, and -work are
shared with the build command. For documentation, see 'go help build'.
Remove object files and cached gomobile files
# Remove object files and cached gomobile files
Usage:
gomobile clean
Clean removes object files and cached NDK files downloaded by gomobile init
# Clean removes object files and cached NDK files downloaded by gomobile init
Build OpenAL for Android
@ -148,8 +144,7 @@ If a OpenAL source directory is specified with -openal, init will
build an Android version of OpenAL for use with gomobile build
and gomobile install.
Compile android APK and install on device
# Compile android APK and install on device
Usage:
@ -164,8 +159,7 @@ The build flags -a, -i, -n, -x, -gcflags, -ldflags, -tags, -trimpath, and -work
shared with the build command.
For documentation, see 'go help build'.
Print version
# Print version
Usage:

Просмотреть файл

@ -62,6 +62,7 @@ func (e Event) String() string {
// - It returns CrossOn if it does, and the lifecycle change is positive.
// - It returns CrossOff if it does, and the lifecycle change is negative.
// - Otherwise, it returns CrossNone.
//
// See the documentation for Stage for more discussion of positive and negative
// crosses.
func (e Event) Crosses(s Stage) Cross {

Просмотреть файл

@ -9,7 +9,7 @@ package paint // import "golang.org/x/mobile/event/paint"
// Event indicates that the app is ready to paint the next frame of the GUI.
//
//A frame is completed by calling the App's Publish method.
// A frame is completed by calling the App's Publish method.
type Event struct {
// External is true for paint events sent by the screen driver.
//

Просмотреть файл

@ -25,6 +25,7 @@
// the launcher.
// You can also run the application on your desktop by running the command
// below. (Note: It currently doesn't work on Windows.)
//
// $ go install golang.org/x/mobile/example/basic && basic
package main

Просмотреть файл

@ -37,6 +37,7 @@
// the launcher.
// You can also run the application on your desktop by running the command
// below. (Note: It currently doesn't work on Windows.)
//
// $ go install golang.org/x/mobile/example/network && network
package main

Просмотреть файл

@ -18,7 +18,7 @@
// It is safe to use the destination address as the left-hand side,
// that is, dst *= rhs is dst.Mul(dst, rhs).
//
// WARNING
// # WARNING
//
// The interface to this package is not stable. It will change considerably.
// Only use functions that provide package documentation. Semantics are

Просмотреть файл

@ -92,6 +92,7 @@ func (m *Mat4) Perspective(fov Radian, aspect, near, far float32) {
// Scale sets m to be a scale followed by p.
// It is equivalent to
//
// m.Mul(p, &Mat4{
// {x, 0, 0, 0},
// {0, y, 0, 0},
@ -119,6 +120,7 @@ func (m *Mat4) Scale(p *Mat4, x, y, z float32) {
// Translate sets m to be a translation followed by p.
// It is equivalent to
//
// m.Mul(p, &Mat4{
// {1, 0, 0, x},
// {0, 1, 0, y},

Просмотреть файл

@ -22,7 +22,7 @@ https://www.khronos.org/opengles/sdk/docs/man/
One notable departure from the C API is the introduction of types
to represent common uses of GLint: Texture, Surface, Buffer, etc.
Debug Logging
# Debug Logging
A tracing version of the OpenGL bindings is behind the `gldebug` build
tag. It acts as a simplified version of apitrace. Build your Go binary

Просмотреть файл

@ -12,9 +12,9 @@
// sent to unmarshalling. This allows tests to validate each struct representation
// of the binary format as follows:
//
// * unmarshal the output of aapt
// * marshal the struct representation
// * perform byte-to-byte comparison with aapt output per chunk header and body
// - unmarshal the output of aapt
// - marshal the struct representation
// - perform byte-to-byte comparison with aapt output per chunk header and body
//
// This process should strive to make structs idiomatic to make parsing xml text
// into structs trivial.
@ -22,8 +22,8 @@
// Once the struct representation is validated, tests for parsing xml text
// into structs can become self-referential as the following holds true:
//
// * the unmarshalled input of aapt output is the only valid target
// * the unmarshalled input of xml text may be compared to the unmarshalled
// - the unmarshalled input of aapt output is the only valid target
// - the unmarshalled input of xml text may be compared to the unmarshalled
// input of aapt output to identify errors, e.g. text-trims, wrong flags, etc
//
// This provides validation, byte-for-byte, for producing binary xml resources.

Просмотреть файл

@ -25,6 +25,7 @@ func (ref PoolRef) Resolve(pl *Pool) string {
// Pool is a container for string and style span collections.
//
// Pool has the following structure marshalled:
//
// chunkHeader
// uint32 number of strings in this pool
// uint32 number of style spans in pool
@ -35,12 +36,14 @@ func (ref PoolRef) Resolve(pl *Pool) string {
// []uint16 or []uint8 concatenation of string entries
//
// UTF-16 entries are as follows:
//
// uint16 string length, exclusive
// uint16 [optional] low word if high bit of length set
// [n]byte data
// uint16 0x0000 terminator
//
// UTF-8 entries are as follows:
//
// uint8 character length, exclusive
// uint8 [optional] low word if high bit of character length set
// uint8 byte length, exclusive

Просмотреть файл

@ -22,6 +22,7 @@ type TableRef uint32
// Resolve returns the Entry of TableRef in the given table.
//
// A TableRef is structured as follows:
//
// 0xpptteeee
// pp: package index
// tt: type spec index in package
@ -127,8 +128,10 @@ func OpenTable() (*Table, error) {
// indices.
//
// For example:
//
// tbl.SpecByName("@android:style/Theme.NoTitleBar")
// tbl.SpecByName("style")
//
// Both locate the spec by name "style".
func (tbl *Table) SpecByName(name string) (int, *Package, int, *TypeSpec, error) {
n := strings.TrimPrefix(name, "@android:")

Просмотреть файл

@ -7,15 +7,17 @@
// It is used by the language specific importers to determine the set of
// wrapper types to be generated.
//
// For example, in the Go file
// # For example, in the Go file
//
// package javaprogram
//
// import "Java/java/lang"
//
// func F() {
//
// o := lang.Object.New()
// ...
//
// }
//
// the java importer uses this package to determine that the "java/lang"
@ -39,7 +41,7 @@ import (
// References is the result of analyzing a Go file or set of Go packages.
//
// For example, the Go file
// # For example, the Go file
//
// package pkg
//
@ -124,7 +126,9 @@ func AnalyzePackages(pkgs []*packages.Package, pkgPrefix string) (*References, e
// import "Prefix/some/Package"
//
// type T struct {
//
// Package.Class
//
// }
func (v *refsSaver) findEmbeddingStructs(pkgpath string, pkg *ast.Package) {
var names []string

Просмотреть файл

@ -178,6 +178,7 @@ func javapPath() (string, error) {
//
// Compiled from "System.java"
// public final class java.lang.System {
//
// public static final java.io.InputStream in;
// descriptor: Ljava/io/InputStream;
// public static final java.io.PrintStream out;