Folders

How to open .GO files (Go source code) on Android, Windows and Linux

What .go, .rs, .zig, .nim, .v and .d files are and how to open, read and edit Go, Rust and other systems code for free on Android, Windows and Linux.

Cover: Folders' text editor on two phones, labelled .GO

You’re reviewing a pull request on your phone and want to see the whole of server.go, not just the diff. Or you downloaded a Rust project and want to read main.rs before building anything. The phone has no idea what these files are.

They’re source code, saved as plain text. Folders opens Go, Rust, Zig, Nim, V and D files in its text editor on Android, Windows and Linux, with line numbers, search and editing.

What is a .go file?

A .go file holds code in Go, the language Google made public in 2009, designed by Robert Griesemer, Rob Pike and Ken Thompson. Go compiles to a single program file with no extra runtime to install, which is why so many command-line tools and cloud programs (Docker and Kubernetes among them) are written in it. Go code has one house style, enforced by the gofmt tool, and that style indents with tabs.

The other languages here are newer systems languages, each aimed at the jobs C and C++ have done for decades:

Extension Language or format What it’s for
.go Go Servers, command-line tools, cloud infrastructure
.rs Rust Memory-safe systems code: tools, browsers, parts of operating systems
.zig Zig A small C-like language; its compiler can also build C code
.nim Nim Python-like syntax that compiles to C, C++ or JavaScript
.v V (or Verilog, or Coq) Code in the V language, but see below
.d D (or a make dependency file) Code in the D language, but see below

Short extensions, several meanings

Two of these extensions are shared:

  • .v is used by the V language, but also by Verilog, a language for designing computer chips, and by the Coq proof assistant. A .v file from an electronics course is almost certainly Verilog: look for module and endmodule.
  • .d is used by the D language, created by Walter Bright, but GCC and Clang also write .d files when asked to track dependencies (the -MMD option). Those are tiny Makefile rules listing which headers an object file depends on, and they turn up in build folders by the hundred.

Whatever the language, Folders opens the file as text.

How to open a .go file with Folders

On Android

  1. Download Folders from the download section and install it. Android 7.0 or newer is enough.
  2. Open Folders and tap Allow access, then allow All files access when Android asks.
  3. Browse to the project, or search for the file name.
  4. Tap the .go, .rs or other file to open it in the text editor.

For a file someone sent you, tap it in the email or chat app and choose Open with → Folders. Projects shared as ZIP or tar.gz archives open in Folders like folders, and any file inside opens with a tap.

On Windows and Linux

  1. Install Folders: the Windows installer, or a deb, rpm, AppImage, Flatpak, Snap or tar.gz package for Linux.
  2. Find the file in Folders and double-click it.
  3. On Windows you can also right-click a file in File Explorer and choose Open with → Folders, as the installer adds Folders there for the types it opens.

What you can do with it in Folders

  • Highlighting. Go, Rust, Zig, V and D files get colours for keywords, strings, numbers, // and /* */ comments, and type names. Nim uses # for comments, and Folders colours it that way, along with its strings and keywords.
  • Follow compiler errors. Go reports ./main.go:17:2: undefined: handler, and Rust points to --> src/main.rs:10:5. Type the line number into Go to line.
  • Search the code. Find every use of a function, or Find and replace a name across the file, with Match case so Config and config stay separate.
  • Keep several files open. Tabs let you have main.rs, lib.rs and a module open at the same time.
  • Make small edits and save. Undo and redo are there, along with word wrap and smaller or larger text for long lines.
  • Document info shows the line and column, the encoding and whether the file uses Unix (LF) or Windows (CRLF) line endings.

It’s a reader and editor, not a toolchain: Folders doesn’t compile, format, lint or run code.

Other ways to open .go files

  • Visual Studio Code with the Go extension, or with rust-analyzer for Rust; extensions exist for Zig, Nim, V and D too.
  • GoLand or RustRover, JetBrains’ IDEs for Go and Rust.
  • The Go Playground (go.dev/play) and Rust Playground (play.rust-lang.org) run small programs in a browser.
  • Any plain text editor, such as Notepad, gedit or Kate.

Problems opening a .go file?

  • The .v file doesn’t look like V. It’s probably Verilog or Coq. The text is fine; it’s just another language.
  • A folder full of tiny .d files. These are dependency files from a C or C++ build, not D code. They’re safe to read and are recreated on the next build.
  • The file is a compiled program. A Go or Rust build produces one large binary with no extension on Linux, or an .exe on Windows. That’s machine code: the hex viewer will show its bytes, but there’s no source code in it.

Questions people ask

Can I open a .go file on Android? Yes. Folders shows it with highlighting and line numbers, and you can edit and save it. Running it needs Go installed on a computer.

How do I run a .go file? With Go installed, go run main.go compiles and runs it in one step. go build makes a program file you can keep.

What opens .rs files? Any text editor, since they’re Rust source code. To build them, install Rust and run cargo run in the project folder, or rustc main.rs for a single file.

.go vs .rs: which is which? .go is Go, a simpler language with a garbage collector. .rs is Rust, which manages memory without one and checks more at compile time.

Rust’s Cargo.toml is covered in how to open YAML and TOML files, and C and C++ in how to open .c, .h and .cpp files. Or see all 382 file types Folders opens.

Keep reading