GoLand operation of setting project gopath

Time:2021-8-31

Open someone else’s go project with GoLand. Golan cannot find package “server / common / config” in any of:

This is because the gopath of the project is not set

Setting method

Supplement: Golan creates a go project and configures the current project gopath

1. New project uncheck index entity gopath

Gopath is the project deployment and construction directory. By default, it is the C: \ user \ XXX \ go folder. All third-party packages downloaded by the go get command will be placed in this directory. When checked, the global gopath variable configured in the environment variable will be used by default. The created project does not know why it cannot import self-defined packages and functions. It does not know what to do for the time being. It will be updated when it knows what to do in the future, I hope some big guys can see it and comment. Let’s uncheck here first.

在这里插入图片描述

2. Create the directory structure of gopath

在这里插入图片描述

3. Set gopath of the project

在这里插入图片描述

Select go gopath, click the plus sign of project gopath + add the path of the current project, uncheck use gopath that’s defined in system environment, and check index entity gopath

在这里插入图片描述

4. Test

Create the project test under SRC, the main function and the function calling other custom packages:

After the demo1.go file is created, the default package is test and can be modified to main. All go files created in the root directory of test belong to the main package

在这里插入图片描述

在这里插入图片描述

The above is my personal experience. I hope I can give you a reference, and I hope you can support developpaer. If you have any mistakes or don’t consider completely, please don’t hesitate to comment.

Recommended Today

The selector returned by ngrx store createselector performs one-step debugging of fetching logic

Test source code: import { Component } from ‘@angular/core’; import { createSelector } from ‘@ngrx/store’; export interface State { counter1: number; counter2: number; } export const selectCounter1 = (state: State) => state.counter1; export const selectCounter2 = (state: State) => state.counter2; export const selectTotal = createSelector( selectCounter1, selectCounter2, (counter1, counter2) => counter1 + counter2 ); // […]