In this case, I’ll change it to point to the Github hosted repository, e.g., /dlsniper/modulesdemo. It contains the name of the module, the minimum Go version the module is compatible with, and any required third-party packages.īy default, the IDE automatically sets the module name to be the name of the folder, but we can customize it to whatever we want. This file is the equivalent to the package.json from Node.js or requirements.txt from Python’s pip command. Go uses “” as the default value, but this is overwritten by the value in the IDE proxy field.Īfter the project is created, the project will contain a new file called go.mod. However, you can also point it to your own proxy server if you work in a company that doesn’t allow direct internet connections or wants a clear record of what dependencies and versions are used. This means that Go will connect directly to the dependency location, e.g. By default, GoLand uses “direct” as a value. You’ll also see that there’s an option to configure the proxy. Then, make sure to use the latest Go SDK as mentioned above, and select whether you want to use the vendoring mode or not. You can select any folder on the computer, as we are no longer limited to GOPATH. Then, select Go Modules (vgo) and choose where to place the project. Once you have everything in place, start the IDE and click on the New Project option. Make sure that you have GoLand 2019.3.2 or newer installed, as this series relies on the features found in this newer version of the IDE. While Go 1.11 is the minimum Go version that uses Go Modules, the recent developments in Go 1.13 mean that is it better for this type of project. Let’s start by making sure that we are working with the latest version of Go. Using a dependency with a new major version.Versioning and migrating to a new major version.Visualising the dependencies of a project.Starting with a new Go Module from scratch.This series of articles is broken down into the following sections: Today, we’ll have a look at how to transform our development model to use them without hassle. Development for Go Modules continues in Go 1.13 and the support GoLand has for them too.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |