summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-01-29 02:30:02 +0000
committerGitHub <noreply@github.com>2020-01-28 21:30:02 -0500
commit82a979707a69f1927216cc292b0389fe236f6350 (patch)
tree3d1a9c43f128fd8f45e2ff2144f0ae37dbe1a5f6
parentdb42a15fa01b27fce2ff792fa26365edeae1894d (diff)
downloadgitea-82a979707a69f1927216cc292b0389fe236f6350.tar.gz
gitea-82a979707a69f1927216cc292b0389fe236f6350.zip
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 <art27@cantab.net> * fixup * Apply suggestions from code review Co-Authored-By: Antoine GIRARD <sapk@users.noreply.github.com> Co-Authored-By: Bagas Sanjaya <bagasdotme@gmail.com> * Apply suggestions from code review * Fix GOPATH settings Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com> Co-authored-by: Bagas Sanjaya <bagasdotme@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
-rw-r--r--Makefile3
-rw-r--r--README.md4
-rw-r--r--docs/content/doc/advanced/hacking-on-gitea.en-us.md30
-rw-r--r--docs/content/doc/installation/from-source.en-us.md14
4 files changed, 24 insertions, 27 deletions
diff --git a/Makefile b/Makefile
index 882c8c5ba4..4754abcfe0 100644
--- a/Makefile
+++ b/Makefile
@@ -5,8 +5,9 @@ export GO111MODULE=off
GO ?= go
SED_INPLACE := sed -i
SHASUM ?= shasum -a 256
+GOPATH ?= $(shell $(GO) env GOPATH)
-export PATH := $($(GO) env GOPATH)/bin:$(PATH)
+export PATH := $(GOPATH)/bin:$(PATH)
ifeq ($(OS), Windows_NT)
EXECUTABLE ?= gitea.exe
diff --git a/README.md b/README.md
index f27b5b38fe..66a740bd40 100644
--- a/README.md
+++ b/README.md
@@ -33,6 +33,10 @@ From the root of the source tree, run:
TAGS="bindata" make build
+or if sqlite support is required:
+
+ TAGS="bindata sqlite sqlite_unlock_notify" make build
+
More info: https://docs.gitea.io/en-us/install-from-source/
## Using
diff --git a/docs/content/doc/advanced/hacking-on-gitea.en-us.md b/docs/content/doc/advanced/hacking-on-gitea.en-us.md
index fdccdf1921..9c865ebf11 100644
--- a/docs/content/doc/advanced/hacking-on-gitea.en-us.md
+++ b/docs/content/doc/advanced/hacking-on-gitea.en-us.md
@@ -50,31 +50,23 @@ is the relevant line - but this may change.)
## Downloading and cloning the Gitea source code
-Go is quite opinionated about where it expects its source code, and simply
-cloning the Gitea repository to an arbitrary path is likely to lead to
-problems - the fixing of which is out of scope for this document. Further, some
-internal packages are referenced using their respective GitHub URL and at
-present we use `vendor/` directories.
-
-The recommended method of obtaining the source code is by using the `go get` command:
+The recommended method of obtaining the source code is by using `git clone`.
```bash
-go get -d code.gitea.io/gitea
-cd "$GOPATH/src/code.gitea.io/gitea"
+git clone https://github.com/go-gitea/gitea
```
-This will clone the Gitea source code to: `"$GOPATH/src/code.gitea.io/gitea"`, or if `$GOPATH`
-is not set `"$HOME/go/src/code.gitea.io/gitea"`.
+(Since the advent of go modules, it is no longer necessary to build go projects
+from within the `$GOPATH`, hence the `go get` approach is no longer recommended.)
## Forking Gitea
-As stated above, you cannot clone Gitea to an arbitrary path. Download the master Gitea source
-code as above. Then, fork the [Gitea repository](https://github.com/go-gitea/gitea) on GitHub,
+Download the master Gitea source code as above. Then, fork the
+[Gitea repository](https://github.com/go-gitea/gitea) on GitHub,
and either switch the git remote origin for your fork or add your fork as another remote:
```bash
# Rename original Gitea origin to upstream
-cd "$GOPATH/src/code.gitea.io/gitea"
git remote rename origin upstream
git remote add origin "git@github.com:$GITHUB_USERNAME/gitea.git"
git fetch --all --prune
@@ -84,7 +76,6 @@ or:
```bash
# Add new remote for our fork
-cd "$GOPATH/src/code.gitea.io/gitea"
git remote add "$FORK_NAME" "git@github.com:$GITHUB_USERNAME/gitea.git"
git fetch --all --prune
```
@@ -114,7 +105,7 @@ how our continuous integration works.
### Formatting, code analysis and spell check
-Our continous integration will reject PRs that are not properly formatted, fail
+Our continuous integration will reject PRs that are not properly formatted, fail
code analysis or spell check.
You should format your code with `go fmt` using:
@@ -237,8 +228,9 @@ have written integration tests; however, these are database dependent.
TAGS="bindata sqlite sqlite_unlock_notify" make build test-sqlite
```
-will run the integration tests in an sqlite environment. Other database tests
-are available but may need adjustment to the local environment.
+will run the integration tests in an sqlite environment. Integration tests
+require `git lfs` to be installed. Other database tests are available but
+may need adjustment to the local environment.
Look at
[`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
can test your changes to ensure that they pass continuous integration using:
```bash
-cd "$GOPATH/src/code.gitea.io/gitea/docs"
+# from the docs directory within Gitea
make trans-copy clean build
```
diff --git a/docs/content/doc/installation/from-source.en-us.md b/docs/content/doc/installation/from-source.en-us.md
index f5e12182a3..fcd6fae166 100644
--- a/docs/content/doc/installation/from-source.en-us.md
+++ b/docs/content/doc/installation/from-source.en-us.md
@@ -38,17 +38,17 @@ Gitea</a>
## Download
-First, retrieve the source code. The easiest way is to use the Go tool. Use the
-following commands to fetch the source and switch into the source directory.
-Go is quite opinionated about where it expects its source code, and simply
-cloning the Gitea repository to an arbitrary path is likely to lead to
-problems - the fixing of which is out of scope for this document.
+First, we must retrieve the source code. Since, the advent of go modules, the
+simplest way of doing this is to use git directly as we no longer have to have
+gitea built from within the GOPATH.
```bash
-go get -d -u code.gitea.io/gitea
-cd "$GOPATH/src/code.gitea.io/gitea"
+git clone https://github.com/go-gitea/gitea
```
+(Previous versions of this document recommended using `go get`. This is
+no longer necessary.)
+
Decide which version of Gitea to build and install. Currently, there are
multiple options to choose from. The `master` branch represents the current
development version. To build with master, skip to the [build section](#build).