mobile Documentation

Official Go developer resources and documentation for golang/mobile with 6.2k stars. Verified technical context for AI.

6,163 stars Go Go 1 file ยท ~1,453 tokens
RAW Doc

1. Project Overview & Quickstart (golang/mobile)

File: README.md

Go support for Mobile devices

The Go mobile repository holds packages and build tools for using Go on mobile platforms.

Package documentation as a starting point:

The Go Mobile project is experimental. Use this at your own risk.
While we are working hard to improve it, neither Google nor the Go
team can provide end-user support.

This is early work and installing the build system requires Go 1.5.
Follow the instructions on
golang.org/wiki/Mobile
to install the gomobile command, build the
basic
and the bind example apps.

--

Contributions to Go are appreciated. See https://go.dev/doc/contribute.

The git repository is https://go.googlesource.com/mobile.


File: example/ivy/android/README.md

Ivy Big Number Calculator (Android)

Ivy (robpike.io/ivy) is an interpreter for an APL-like language written in Go.
This repository hosts a minimal Android project used for its Android version.

How to build

Requirements

  • Go 1.17 or newer
  • Android SDK
  • Android NDK
  • golang.org/x/mobile/cmd/gomobile

The gomobile command respects the ANDROID_HOME and ANDROID_NDK_HOME environment variables. If gomobile can't find your SDK and NDK, you can set these environment variables to specify their locations:

text
export ANDROID_HOME=/path/to/sdk-directory
export ANDROID_NDK_HOME=/path/to/ndk-directory

From this directory, run:

sh
go install golang.org/x/mobile/cmd/gomobile@latest
  go install golang.org/x/mobile/cmd/gobind@latest

  # Make sure `gomobile` and `gobind` is in your `PATH`.
  gomobile bind -o app/ivy.aar robpike.io/ivy/mobile

Open this directory from Android Studio, and build.

robpike.io/ivy and golang.org/x/mobile are required dependencies of this main module. In order to update them:

text
go get -d golang.org/x/mobile@latest
  go get -d robpike.io/ivy/mobile
  go mod tidy

File: example/ivy/ios/README.md

Ivy iOS App source

This directory contains the source code to the Ivy iOS app.

To build, first create the Mobile.xcframework out of the Go
implementation of Ivy. Run:

text
go install golang.org/x/mobile/cmd/gomobile@latest
go install golang.org/x/mobile/cmd/gobind@latest

to install gomobile and gobind. Then:

text
mkdir work; cd work
go mod init work
go get -d golang.org/x/mobile/bind@latest
go get -d robpike.io/ivy/mobile
gomobile bind -target=ios,iossimulator,maccatalyst,macos robpike.io/ivy/mobile robpike.io/ivy/demo

Place the Mobile.xcframework directory in this directory, and
then open ivy.xcodeproj in Xcode.

You have to specify Development Team for code signing certificate in:
Project Settings -> Targets -> Signing & Capabilities -> Signing -> Team.

2. Official Technical Reference & Guides (golang/website)

Go website

This repo holds content and serving programs for the go.dev and golang.org web sites.

Content is in _content/ (go.dev) and tour/ (go.dev/tour).
Server code is in cmd/ and internal/.

To run the combined go.dev+golang.org server to preview local content changes, use:

text
go run ./cmd/golangorg

The supporting programs cmd/admingolangorg and cmd/googlegolangorg
are the servers for admin.golang.org and google.golang.org.
(They do not use the _content/ directories.)

Each command directory has its own README.md explaining deployment.

JS/TS/CSS Formatting

This repository uses eslint to format JS and TS files,
and stylelint to format CSS files.

See also:

It is encouraged that all JS, TS, and CSS code be run through formatters before
submitting a change. However, it is not a strict requirement enforced by CI.

Installing npm Dependencies:

  1. Install docker
  2. Create a .gitignore file at repo root
  3. Add .gitignore and node_modules to .gitignore
  4. Run ./npm install

Run ESlint

text
./npx eslint [options] [file] [dir]

Run Stylelint

text
./npx stylelint [input] [options]

TypeScript Support

TypeScript files served from _content are transformed into JavaScript.
Reference .ts files in html templates as module code.

<script type="module" src="/ts/filename.ts">

Write unit tests for TypeScript code using the jest
testing framework.

Run Jest

text
./npx jest [TestPathPattern]

Deploying

Each time a CL is reviewed and submitted, the code is deployed to App Engine.
See cmd/golangorg/README.md for details.

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to
this repository, see https://go.dev/doc/contribute.

The git repository is https://go.googlesource.com/website.

The main issue tracker for the website repository is located at
https://go.dev/issues. Prefix your issue with "x/website:" in the
subject line, so it is easy to find.