Skip to content

Commit 82a9797

Browse files
zeripathsapkbagasmelunnytechknowlogick
authored
Update documentation for the go module era (#9751)
* Update documentation for the go module era use go env instead of $GOPATH Update instructions to just use git clone Slight update to readme Signed-off-by: Andrew Thornton <[email protected]> * fixup * Apply suggestions from code review Co-Authored-By: Antoine GIRARD <[email protected]> Co-Authored-By: Bagas Sanjaya <[email protected]> * Apply suggestions from code review * Fix GOPATH settings Co-authored-by: Antoine GIRARD <[email protected]> Co-authored-by: Bagas Sanjaya <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Co-authored-by: techknowlogick <[email protected]>
1 parent db42a15 commit 82a9797

File tree

4 files changed

+24
-27
lines changed

4 files changed

+24
-27
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ export GO111MODULE=off
55
GO ?= go
66
SED_INPLACE := sed -i
77
SHASUM ?= shasum -a 256
8+
GOPATH ?= $(shell $(GO) env GOPATH)
89

9-
export PATH := $($(GO) env GOPATH)/bin:$(PATH)
10+
export PATH := $(GOPATH)/bin:$(PATH)
1011

1112
ifeq ($(OS), Windows_NT)
1213
EXECUTABLE ?= gitea.exe

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ From the root of the source tree, run:
3333

3434
TAGS="bindata" make build
3535

36+
or if sqlite support is required:
37+
38+
TAGS="bindata sqlite sqlite_unlock_notify" make build
39+
3640
More info: https://docs.gitea.io/en-us/install-from-source/
3741

3842
## Using

docs/content/doc/advanced/hacking-on-gitea.en-us.md

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,23 @@ is the relevant line - but this may change.)
5050

5151
## Downloading and cloning the Gitea source code
5252

53-
Go is quite opinionated about where it expects its source code, and simply
54-
cloning the Gitea repository to an arbitrary path is likely to lead to
55-
problems - the fixing of which is out of scope for this document. Further, some
56-
internal packages are referenced using their respective GitHub URL and at
57-
present we use `vendor/` directories.
58-
59-
The recommended method of obtaining the source code is by using the `go get` command:
53+
The recommended method of obtaining the source code is by using `git clone`.
6054

6155
```bash
62-
go get -d code.gitea.io/gitea
63-
cd "$GOPATH/src/code.gitea.io/gitea"
56+
git clone https://github.com/go-gitea/gitea
6457
```
6558

66-
This will clone the Gitea source code to: `"$GOPATH/src/code.gitea.io/gitea"`, or if `$GOPATH`
67-
is not set `"$HOME/go/src/code.gitea.io/gitea"`.
59+
(Since the advent of go modules, it is no longer necessary to build go projects
60+
from within the `$GOPATH`, hence the `go get` approach is no longer recommended.)
6861

6962
## Forking Gitea
7063

71-
As stated above, you cannot clone Gitea to an arbitrary path. Download the master Gitea source
72-
code as above. Then, fork the [Gitea repository](https://github.com/go-gitea/gitea) on GitHub,
64+
Download the master Gitea source code as above. Then, fork the
65+
[Gitea repository](https://github.com/go-gitea/gitea) on GitHub,
7366
and either switch the git remote origin for your fork or add your fork as another remote:
7467

7568
```bash
7669
# Rename original Gitea origin to upstream
77-
cd "$GOPATH/src/code.gitea.io/gitea"
7870
git remote rename origin upstream
7971
git remote add origin "[email protected]:$GITHUB_USERNAME/gitea.git"
8072
git fetch --all --prune
@@ -84,7 +76,6 @@ or:
8476

8577
```bash
8678
# Add new remote for our fork
87-
cd "$GOPATH/src/code.gitea.io/gitea"
8879
git remote add "$FORK_NAME" "[email protected]:$GITHUB_USERNAME/gitea.git"
8980
git fetch --all --prune
9081
```
@@ -114,7 +105,7 @@ how our continuous integration works.
114105

115106
### Formatting, code analysis and spell check
116107

117-
Our continous integration will reject PRs that are not properly formatted, fail
108+
Our continuous integration will reject PRs that are not properly formatted, fail
118109
code analysis or spell check.
119110

120111
You should format your code with `go fmt` using:
@@ -237,8 +228,9 @@ have written integration tests; however, these are database dependent.
237228
TAGS="bindata sqlite sqlite_unlock_notify" make build test-sqlite
238229
```
239230

240-
will run the integration tests in an sqlite environment. Other database tests
241-
are available but may need adjustment to the local environment.
231+
will run the integration tests in an sqlite environment. Integration tests
232+
require `git lfs` to be installed. Other database tests are available but
233+
may need adjustment to the local environment.
242234

243235
Look at
244236
[`integrations/README.md`](https://github.com/go-gitea/gitea/blob/master/integrations/README.md)
@@ -257,7 +249,7 @@ Documentation for the website is found in `docs/`. If you change this you
257249
can test your changes to ensure that they pass continuous integration using:
258250

259251
```bash
260-
cd "$GOPATH/src/code.gitea.io/gitea/docs"
252+
# from the docs directory within Gitea
261253
make trans-copy clean build
262254
```
263255

docs/content/doc/installation/from-source.en-us.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ Gitea</a>
3838

3939
## Download
4040

41-
First, retrieve the source code. The easiest way is to use the Go tool. Use the
42-
following commands to fetch the source and switch into the source directory.
43-
Go is quite opinionated about where it expects its source code, and simply
44-
cloning the Gitea repository to an arbitrary path is likely to lead to
45-
problems - the fixing of which is out of scope for this document.
41+
First, we must retrieve the source code. Since, the advent of go modules, the
42+
simplest way of doing this is to use git directly as we no longer have to have
43+
gitea built from within the GOPATH.
4644

4745
```bash
48-
go get -d -u code.gitea.io/gitea
49-
cd "$GOPATH/src/code.gitea.io/gitea"
46+
git clone https://github.com/go-gitea/gitea
5047
```
5148

49+
(Previous versions of this document recommended using `go get`. This is
50+
no longer necessary.)
51+
5252
Decide which version of Gitea to build and install. Currently, there are
5353
multiple options to choose from. The `master` branch represents the current
5454
development version. To build with master, skip to the [build section](#build).

0 commit comments

Comments
 (0)