Skip to content

Add GoLand configuration in hacking on gitea #16843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/content/doc/developers/hacking-on-gitea.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,19 @@ Visual Studio Code. Look at
[`contrib/ide/README.md`](https://github.com/go-gitea/gitea/blob/main/contrib/ide/README.md)
for more information.

## GoLand

Clicking the `Run Application` arrow on the function `func main()` in `/main.go`
can quickly start a debuggable gitea instance.

The `Output Directory` in `Run/Debug Configuration` MUST be set to the
gitea project directory (which contains `main.go` and `go.mod`),
otherwise, the started instance's working directory is a GoLand's temporary directory
and prevents gitea from loading dynamic resources (eg: templates) in a development environment.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah if that's the only problem then you could consider setting one of the custom_dir or other environment variables. But this sounds easier overall.


To run unit tests with SQLite in GoLand, set `-tags sqlite,sqlite_unlock_notify`
in `Go tool arguments` of `Run/Debug Configuration`.
Copy link
Member

@silverwind silverwind Aug 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could GoLand be made to just call make test-backend? I don't like having these tags in documentation as sooner or later, they will change and then this document will be outdated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In vscode I also have to add these tags.

The main benefit is that you can just get editor to run the test individually without having to run through the entire source code tree looking for the matching test name.

It's much much faster

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add that if you're debugging or otherwise running code you will need to set the appropriate build tags anyway. For example if you're debugging gogit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yeah I guess i agree. Maybe we should at least reference that these default tags come from the Makefile.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@silverwind Yes, GoLand can call make test-backend, just add an entry in Run/Debug Configuration. This guide can run a single unit test, which is very handy and efficient.


## Submitting PRs

Once you're happy with your changes, push them up and open a pull request. It
Expand Down