Skip to content

Commit 2ce8597

Browse files
authored
Merge pull request #229 from bytecodealliance/ydnar/go-imports
docs: update README
2 parents dc6c46f + 0b4b483 commit 2ce8597

File tree

1 file changed

+38
-15
lines changed

1 file changed

+38
-15
lines changed

docs/README.md

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,45 @@
1-
# go.bytecodealliance.org Go import paths
1+
# Go Import Paths
22

3-
This directory hosts the configuration for Go vanity URLs under `go.bytecodealliance.org` domain.
3+
This directory hosts the configuration for [Go module import paths](https://golang.org/cmd/go/#hdr-Remote_import_paths) under the `go.bytecodealliance.org` domain. Each unique Go module (with a separate `go.mod` file) must have a corresponding directory and `index.html` file linking to this repository (or another respository, see below).
44

5-
More information about vanity URLs can be found in the [Go documentation](https://golang.org/cmd/go/#hdr-Remote_import_paths).
5+
Packages within a named module, e.g. `go.bytecodealliance.org/cm` will automatically be found.
66

7-
## Adding a new vanity URL
7+
## Creating a New Module
88

9-
If you want to create a vanity URL `go.bytecodealliance.org/foo` pointing to `github.com/bytecodealliance/go-foo`:
9+
### In This Repository
1010

11-
- Create directory `docs/foo`
12-
- Create file `docs/foo/index.html` with the following content:
11+
To create a new Go module `go.bytecodealliance.org/gopher` **in this repository**:
1312

14-
```html
15-
<html>
16-
<head>
17-
<meta name="go-import" content="go.bytecodealliance.org/foo git https://github.com/bytecodealliance/go-foo" />
18-
</head>
19-
</html>
20-
```
13+
1. Create a new `gopher` directory in the root of this repository.
14+
2. In the `gopher` directory, run `go mod init go.bytecodealliance.org/gopher`.
15+
3. Create a new `docs/gopher` directory.
16+
4. Create a file `docs/gopher/index.html` with the following content:
2117

22-
NOTE: Vanity URLs must be unique and not shadow existing package names in this repository. For example: Creating a vanity URL `go.bytecodealliance.org/cm` would shadow the `cm` package in this repository.
18+
```html
19+
<html>
20+
<head>
21+
<meta name="go-import" content="go.bytecodealliance.org/gopher git https://github.com/bytecodealliance/go-modules" />
22+
</head>
23+
</html>
24+
```
25+
5. Commit these changes and submit a Pull Request to this repository.
26+
27+
### In Another Repository
28+
29+
To create a new Go module `go.bytecodealliance.org/wasmtime` **in another repository** (e.g. github.com/bytecodealliance/wasmtime-go).
30+
31+
1. In the `wasmtime-go` repository, run `go mod init go.bytecodealliance.org/wasmtime`.
32+
2. In this repository, create a new `docs/wasmtime` directory.
33+
3. Create a file `docs/wasmtime/index.html` with the following content:
34+
35+
```html
36+
<html>
37+
<head>
38+
<meta name="go-import" content="go.bytecodealliance.org/wasmtime git https://github.com/bytecodealliance/wasmtime-go" />
39+
</head>
40+
</html>
41+
```
42+
4. Commit these changes and submit a Pull Request to this repository.
43+
44+
45+
**Note**: Go import paths must be unique and not shadow existing package names in this repository. For example: Creating an import path `go.bytecodealliance.org/cm` would shadow package `cm` in this repository.

0 commit comments

Comments
 (0)