Skip to content
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

Add GoLand configuration in hacking on gitea #16843

Merged
merged 3 commits into from
Aug 29, 2021

Conversation

wxiaoguang
Copy link
Contributor

As discussed in #develop channel, GoLand users need a guide how to develop gitea.

and prevents gitea from loading dynamic resources (eg: templates) in a development environment.

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

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.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 28, 2021
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.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Aug 28, 2021
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Aug 28, 2021
@codecov-commenter

This comment has been minimized.

@techknowlogick techknowlogick added the type/docs This PR mainly updates/creates documentation label Aug 29, 2021
@techknowlogick techknowlogick merged commit d24eb6e into go-gitea:main Aug 29, 2021
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/docs This PR mainly updates/creates documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants