porters-handbook: update Go porting notes for D28184
Approved by: crees (doc) Differential Revision: https://reviews.freebsd.org/D28789
This commit is contained in:
parent
4d8cfb575f
commit
9a1d65ec41
2 changed files with 28 additions and 0 deletions
|
@ -713,6 +713,31 @@ For ports that use Go, define `USES=go`. Refer to <<uses-go,`go`>> for a list of
|
||||||
.Creating a Port for a Go Modules Based Application
|
.Creating a Port for a Go Modules Based Application
|
||||||
[example]
|
[example]
|
||||||
====
|
====
|
||||||
|
In most cases, it is sufficient to set `GO_MODULE` variable to the value specified by `module` directive in `go.mod`:
|
||||||
|
|
||||||
|
[.programlisting]
|
||||||
|
....
|
||||||
|
PORTNAME= hey
|
||||||
|
PORTVERSION= 0.1.4
|
||||||
|
DISTVERSIONPREFIX= v
|
||||||
|
CATEGORIES= benchmarks
|
||||||
|
|
||||||
|
MAINTAINER= dmgk@FreeBSD.org
|
||||||
|
COMMENT= Tiny program that sends some load to a web application
|
||||||
|
|
||||||
|
LICENSE= APACHE20
|
||||||
|
LICENSE_FILE= ${WRKSRC}/LICENSE
|
||||||
|
|
||||||
|
USES= go:modules
|
||||||
|
GO_MODULE= github.com/rakyll/hey
|
||||||
|
|
||||||
|
PLIST_FILES= bin/hey
|
||||||
|
|
||||||
|
.include <bsd.port.mk>
|
||||||
|
....
|
||||||
|
|
||||||
|
If the "easy" way is not adequate or more control over dependencies is needed, the full porting process is described below.
|
||||||
|
|
||||||
Creating a Go based port is a five stage process. First we need to provide a ports template that fetches the application distribution file:
|
Creating a Go based port is a five stage process. First we need to provide a ports template that fetches the application distribution file:
|
||||||
|
|
||||||
[.programlisting]
|
[.programlisting]
|
||||||
|
|
|
@ -519,6 +519,9 @@ Sets default values and targets used to build Go software. A build dependency on
|
||||||
|
|
||||||
The build process is controlled by several variables:
|
The build process is controlled by several variables:
|
||||||
|
|
||||||
|
`GO_MODULE`::
|
||||||
|
The name of the application module as specified by `module` directive in `go.mod`. In most cases, this is the only requred variable for ports that use Go modules.
|
||||||
|
|
||||||
`GO_PKGNAME`::
|
`GO_PKGNAME`::
|
||||||
The name of the Go package when building in GOPATH mode. This is the directory that will be created in `${GOPATH}/src`. If not set explicitly and `GH_SUBDIR` or `GL_SUBDIR` is present, `GO_PKGNAME` will be inferred from it. It is not needed when building in modules-aware mode.
|
The name of the Go package when building in GOPATH mode. This is the directory that will be created in `${GOPATH}/src`. If not set explicitly and `GH_SUBDIR` or `GL_SUBDIR` is present, `GO_PKGNAME` will be inferred from it. It is not needed when building in modules-aware mode.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue