Repository: raydac/mvn-golang Branch: master Commit: 7f86a51cac31 Files: 229 Total size: 706.6 KB Directory structure: gitextract_sjzi_mot/ ├── .github/ │ └── workflows/ │ └── maven.yml ├── .gitignore ├── .projectKnowledge/ │ └── doc_common.mmd ├── CHANGELOG.md ├── LICENSE ├── README.md ├── mvn-golang-examples/ │ ├── mvn-golang-example-azul3d-mandelbrot/ │ │ ├── pom.xml │ │ ├── resources/ │ │ │ └── azul3d_mandel/ │ │ │ ├── mandel.frag │ │ │ └── mandel.vert │ │ └── src/ │ │ ├── azul3d_mandel.go │ │ ├── go.mod │ │ ├── go.sum │ │ └── mandelbrot.go │ ├── mvn-golang-example-clui/ │ │ ├── pom.xml │ │ ├── res/ │ │ │ └── themes/ │ │ │ ├── acsii.theme │ │ │ └── turbovision.theme │ │ └── src/ │ │ └── main.go │ ├── mvn-golang-example-fyne/ │ │ ├── pom.xml │ │ └── src/ │ │ ├── go.mod │ │ ├── go.sum │ │ └── hello.go │ ├── mvn-golang-example-genbindata/ │ │ ├── data/ │ │ │ └── la_espero.txt │ │ ├── pom.xml │ │ └── src/ │ │ └── main.go │ ├── mvn-golang-example-gocui/ │ │ ├── pom.xml │ │ └── src/ │ │ └── gocui.go │ ├── mvn-golang-example-goexample/ │ │ ├── pom.xml │ │ └── src/ │ │ ├── golang-book/ │ │ │ └── chapter11/ │ │ │ └── math/ │ │ │ ├── math.go │ │ │ └── math_test.go │ │ └── main.go │ ├── mvn-golang-example-goterm/ │ │ ├── pom.xml │ │ └── src/ │ │ └── time.go │ ├── mvn-golang-example-gui/ │ │ ├── dependencies.txt │ │ ├── pom.xml │ │ └── src/ │ │ └── main.go │ ├── mvn-golang-example-gui-gwt/ │ │ ├── backend/ │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main.go │ │ ├── frontend/ │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ ├── main/ │ │ │ │ ├── java/ │ │ │ │ │ └── com/ │ │ │ │ │ └── igormaznitsa/ │ │ │ │ │ └── client/ │ │ │ │ │ ├── BackendService.java │ │ │ │ │ ├── FrontendMain.java │ │ │ │ │ └── Messages.java │ │ │ │ ├── resources/ │ │ │ │ │ └── com/ │ │ │ │ │ └── igormaznitsa/ │ │ │ │ │ ├── client/ │ │ │ │ │ │ └── Messages_fr.properties │ │ │ │ │ └── gwtfrontend.gwt.xml │ │ │ │ └── webapp/ │ │ │ │ ├── WEB-INF/ │ │ │ │ │ └── web.xml │ │ │ │ ├── index.html │ │ │ │ └── main.css │ │ │ └── test/ │ │ │ └── resources/ │ │ │ └── com/ │ │ │ └── igormaznitsa/ │ │ │ └── gotestJUnit.gwt.xml │ │ └── pom.xml │ ├── mvn-golang-example-helloworld/ │ │ ├── pom.xml │ │ └── src/ │ │ └── main.go │ ├── mvn-golang-example-helloworld-gomod/ │ │ ├── pom.xml │ │ └── src/ │ │ ├── go.mod │ │ ├── go.sum │ │ └── main.go │ ├── mvn-golang-example-helloworld-multisrc/ │ │ ├── lib1/ │ │ │ └── src/ │ │ │ └── pack1/ │ │ │ └── src1some.go │ │ ├── lib2/ │ │ │ └── src/ │ │ │ └── pack2/ │ │ │ └── src2some.go │ │ ├── pom.xml │ │ └── src/ │ │ └── main.go │ ├── mvn-golang-example-logrus/ │ │ ├── pom.xml │ │ └── src/ │ │ └── gologrus.go │ ├── mvn-golang-example-maven-module-mix/ │ │ ├── mvn-go-test-mix-app/ │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ └── main.go │ │ ├── mvn-go-test-mix-proxy/ │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── com.igormaznitsa/ │ │ │ └── testmixproxy/ │ │ │ ├── Proxy.go │ │ │ ├── go.mod │ │ │ └── go.sum │ │ ├── mvn-go-test-mix-terminal/ │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── com.igormaznitsa/ │ │ │ └── testmixterminal/ │ │ │ ├── Terminal.go │ │ │ ├── go.mod │ │ │ └── go.sum │ │ └── pom.xml │ ├── mvn-golang-example-maven-repository/ │ │ ├── mvn-go-test-app/ │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── main.go │ │ ├── mvn-go-test-lib/ │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── com.igormaznitsa/ │ │ │ └── mvngotest/ │ │ │ ├── SomeUtils.go │ │ │ └── go.mod │ │ ├── mvn-go-test-libtwo/ │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── com.igormaznitsa/ │ │ │ └── mvngotesttwo/ │ │ │ ├── SomeUtils.go │ │ │ └── go.mod │ │ ├── mvn-go-test-metalib/ │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── com.igormaznitsa/ │ │ │ └── mvngotestmeta/ │ │ │ ├── MetaUtils.go │ │ │ └── go.mod │ │ └── pom.xml │ ├── mvn-golang-example-multimodule/ │ │ ├── app-1/ │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ ├── main.go │ │ │ └── main_test.go │ │ ├── app-2/ │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ ├── main.go │ │ │ └── main_test.go │ │ ├── assembly-results/ │ │ │ ├── deploy.xml │ │ │ └── pom.xml │ │ ├── common/ │ │ │ ├── pom.xml │ │ │ └── src/ │ │ │ └── common/ │ │ │ ├── common.go │ │ │ └── common_test.go │ │ └── pom.xml │ ├── mvn-golang-example-nes/ │ │ └── pom.xml │ ├── mvn-golang-example-oak-shooter/ │ │ ├── pom.xml │ │ └── src/ │ │ ├── go.mod │ │ ├── go.sum │ │ └── performance.go │ ├── mvn-golang-example-plugin/ │ │ ├── pom.xml │ │ └── src/ │ │ ├── arithplugin.go │ │ └── arithplugin_test.go │ ├── mvn-golang-example-preprocessing/ │ │ ├── pom.xml │ │ └── src/ │ │ ├── inlined.go │ │ ├── main.go │ │ └── text.txt │ ├── mvn-golang-example-primitive/ │ │ └── pom.xml │ ├── mvn-golang-example-protobuf/ │ │ ├── go-dependencies.lst │ │ ├── pom.xml │ │ ├── proto/ │ │ │ └── person.proto │ │ └── src/ │ │ └── main.go │ ├── mvn-golang-example-termboxgo/ │ │ ├── pom.xml │ │ └── src/ │ │ └── main.go │ ├── mvn-golang-example-termui/ │ │ ├── pom.xml │ │ └── src/ │ │ ├── go.mod │ │ ├── go.sum │ │ └── sparklines.go │ ├── mvn-golang-example-testing/ │ │ ├── pom.xml │ │ └── src/ │ │ ├── main.go │ │ └── mypackage/ │ │ └── testexample/ │ │ ├── Some.go │ │ └── Some_test.go │ ├── pom.xml │ └── test-git-cvs/ │ ├── cvs-git-branch-master/ │ │ ├── pom.xml │ │ └── src/ │ │ └── main.go │ ├── cvs-git-branch-v2/ │ │ ├── pom.xml │ │ └── src/ │ │ └── main.go │ ├── cvs-git-custom/ │ │ ├── pom.xml │ │ └── src/ │ │ └── main.go │ ├── cvs-git-master-tag/ │ │ ├── pom.xml │ │ └── src/ │ │ └── main.go │ ├── cvs-git-revision/ │ │ ├── pom.xml │ │ └── src/ │ │ └── main.go │ └── pom.xml ├── mvn-golang-hello/ │ ├── pom.xml │ └── src/ │ ├── assemble/ │ │ ├── bundle.xml │ │ └── distribution.xml │ └── main/ │ └── resources/ │ ├── META-INF/ │ │ └── maven/ │ │ └── archetype-metadata.xml │ └── archetype-resources/ │ ├── packages.txt │ ├── pom.xml │ └── src/ │ ├── go.mod │ ├── hello.go │ └── hello_test.go ├── mvn-golang-hello-multi/ │ ├── pom.xml │ └── src/ │ ├── assemble/ │ │ ├── bundle.xml │ │ └── distribution.xml │ └── main/ │ └── resources/ │ ├── META-INF/ │ │ └── maven/ │ │ └── archetype-metadata.xml │ └── archetype-resources/ │ ├── app-1/ │ │ ├── pom.xml │ │ └── src/ │ │ ├── main.go │ │ └── main_test.go │ ├── app-2/ │ │ ├── pom.xml │ │ └── src/ │ │ ├── main.go │ │ └── main_test.go │ ├── assembly-results/ │ │ ├── deploy.xml │ │ └── pom.xml │ ├── common/ │ │ ├── pom.xml │ │ └── src/ │ │ └── common/ │ │ ├── common.go │ │ └── common_test.go │ └── pom.xml ├── mvn-golang-wrapper/ │ ├── pom.xml │ └── src/ │ ├── assemble/ │ │ ├── bundle.xml │ │ └── distribution.xml │ ├── main/ │ │ ├── filtered-resources/ │ │ │ └── META-INF/ │ │ │ └── plexus/ │ │ │ └── components.xml │ │ └── java/ │ │ └── com/ │ │ └── igormaznitsa/ │ │ └── mvngolang/ │ │ ├── AbstractGoDependencyAwareMojo.java │ │ ├── AbstractGoPackageAndDependencyAwareMojo.java │ │ ├── AbstractGoPackageAwareMojo.java │ │ ├── AbstractGolangMojo.java │ │ ├── AbstractModuleAware.java │ │ ├── CustomScript.java │ │ ├── GolangBuildMojo.java │ │ ├── GolangCleanMojo.java │ │ ├── GolangCustomMojo.java │ │ ├── GolangFixMojo.java │ │ ├── GolangFmtMojo.java │ │ ├── GolangGenerateMojo.java │ │ ├── GolangGetMojo.java │ │ ├── GolangInstallMojo.java │ │ ├── GolangJfrogCliMojo.java │ │ ├── GolangListMojo.java │ │ ├── GolangModMojo.java │ │ ├── GolangMvnInstallMojo.java │ │ ├── GolangRunMojo.java │ │ ├── GolangTestMojo.java │ │ ├── GolangToolMojo.java │ │ ├── GolangVetMojo.java │ │ ├── cvs/ │ │ │ ├── AbstractRepo.java │ │ │ ├── CVSType.java │ │ │ ├── CvsBZR.java │ │ │ ├── CvsGIT.java │ │ │ ├── CvsHG.java │ │ │ ├── CvsNone.java │ │ │ └── CvsSVN.java │ │ └── utils/ │ │ ├── GoMod.java │ │ ├── IOUtils.java │ │ ├── MavenUtils.java │ │ ├── MvnGolangArtifactHandler.java │ │ ├── PackageList.java │ │ ├── ProxySettings.java │ │ ├── StringComparatorABC.java │ │ ├── SysUtils.java │ │ ├── Tuple.java │ │ ├── UnpackUtils.java │ │ ├── WildCardMatcher.java │ │ └── XGoogHashHeader.java │ └── test/ │ ├── java/ │ │ └── com/ │ │ └── igormaznitsa/ │ │ └── mvngolang/ │ │ ├── GolangBuildMojoTest.java │ │ ├── GolangModMojoCfgTest.java │ │ └── utils/ │ │ ├── GoModTest.java │ │ ├── MavenUtilsTest.java │ │ ├── PackageListTest.java │ │ ├── StringComparatorABCTest.java │ │ └── SysUtilsTest.java │ └── resources/ │ └── com/ │ └── igormaznitsa/ │ └── mvngolang/ │ ├── mojoBuild.xml │ ├── mojoClean.xml │ ├── mojoCustom.xml │ ├── mojoFix.xml │ ├── mojoFmt.xml │ ├── mojoGenerate.xml │ ├── mojoGet.xml │ ├── mojoInstall.xml │ ├── mojoJFrogCli.xml │ ├── mojoMod.xml │ ├── mojoMvnInstall.xml │ ├── mojoRun.xml │ ├── mojoTest.xml │ ├── mojoTool.xml │ └── mojoVet.xml └── pom.xml ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/workflows/maven.yml ================================================ name: Java CI on: [push] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Build with Maven run: mvn -B package --file pom.xml ================================================ FILE: .gitignore ================================================ **/bin/ **/.preprocessed_src/ **/pkg/ **/target/ pom.xml.tag pom.xml.releaseBackup pom.xml.versionsBackup pom.xml.next release.properties dependency-reduced-pom.xml buildNumber.properties .mvn/timing.properties **/nbproject/ /mvn-golang-examples/mvn-golang-example-gomobile/classes/ /mvn-golang-examples/mvn-golang-example-gomobile/test-classes/ /mvn-golang-examples/mvn-golang-example-antlr/generated/ **/nbactions.xml **/.idea *.iml .settings .project .classpath ================================================ FILE: .projectKnowledge/doc_common.mmd ================================================ Mind Map generated by NB MindMap plugin > __version__=`1.1`,showJumps=`true` --- # MVN\-GOLANG
2\.3\.9 ## module mod aware > fillColor=`#B8EABC`,topicLinkUID=`1784F737589A` - TOPIC
1693D4AFAAFA
### mod > fillColor=`#FF9090` #### Define mod mode > fillColor=`#92FF00`,mmd.emoticon=`information` ##### provided only if defined > fillColor=`#F3F676` ###### properties ####### mvn\.golang\.module\.mod ###### \vendor\ > fillColor=`#00FFFF` ### dependency aware > fillColor=`#B8EABC`,topicLinkUID=`1693D4AFAAFA` #### scanDependencies > fillColor=`#FF9090` ##### Find artifacts generated by Mvn\-Golang among scope dependencies,
unpack them and add unpacked folders into GOPATH during execution > fillColor=`#92FF00`,mmd.emoticon=`information` ###### true > fillColor=`#F3F676` #### includeTestDependencies > fillColor=`#FF9090` ##### Include test dependencies into scanning process\. > fillColor=`#92FF00`,mmd.emoticon=`information` ###### true > fillColor=`#F3F676` #### dependencyTempFolder > fillColor=`#FF9090` ##### Path to the folder where resolved mvn\-golang dependencies
will be temporary unpacked > fillColor=`#92FF00`,mmd.emoticon=`information` ###### $\{project\.build\.directory\}/\.\_\_deps\_\_ > fillColor=`#F3F676` #### syncSessionIfModules > fillColor=`#FF9090` ##### turn on session synchronization
to prevent parallel processing of modules in module mode > fillColor=`#92FF00`,mmd.emoticon=`information` ###### true > fillColor=`#F3F676` ## package aware > fillColor=`#B8EABC`,topicLinkUID=`1693D4A9E73A` ### packages > fillColor=`#FF9090` #### List of packages > fillColor=`#92FF00`,mmd.emoticon=`information` ##### \
\com/some/package\
\com/some/packagetwo\
\
> align=`left`,fillColor=`#00FFFF` ## common > fillColor=`#B8EABC` ### arch > fillColor=`#FF9090` #### Architecture of host system > fillColor=`#92FF00`,mmd.emoticon=`information` ##### \windows\ > fillColor=`#00FFFF` ### addToGoPath > fillColor=`#FF9090` #### Extra folders to be added into GOPATH > fillColor=`#92FF00`,mmd.emoticon=`information` ##### \
\$\{basedir\}/src2\
\$\{basedir\}/src3\
\
> fillColor=`#00FFFF` ### buildFlags > fillColor=`#FF9090` #### List of build flags for a Go tool > fillColor=`#92FF00`,mmd.emoticon=`information` ##### \
\\-a\
\\-v\
\
> align=`left`,fillColor=`#00FFFF` ### checkSdkHash > fillColor=`#FF9090` #### Check hash for downloaded GoSDK archive\. > fillColor=`#92FF00`,mmd.emoticon=`information` ##### true > fillColor=`#F3F676` ###### \false\ > fillColor=`#00FFFF` ### connectionTimeout > fillColor=`#FF9090` #### Timeout for network connections
during GoSDK loading\. > fillColor=`#92FF00`,mmd.emoticon=`information` ##### milliseconds ###### 60000 > fillColor=`#F3F676` ####### \120000\ > fillColor=`#00FFFF` ### disableSSLcheck > fillColor=`#FF9090` #### Disable check of SSL certificate during HTTPS request\. > fillColor=`#92FF00`,mmd.emoticon=`information` ##### properties ###### mvn\.golang\.disable\.ssl\.check ##### false > fillColor=`#F3F676` ###### \true\ > fillColor=`#00FFFF` ### disableSdkLoad > fillColor=`#FF9090` #### Allows to not load GoSDK if it is not in cache\.
Also it is active if maven session in offline mode\. > fillColor=`#92FF00`,mmd.emoticon=`information` ##### false > fillColor=`#F3F676` ###### \true\ > fillColor=`#00FFFF` ### env > fillColor=`#FF9090` #### Allows define environment variables > fillColor=`#92FF00`,mmd.emoticon=`information` ##### \
\off\
\
> align=`left`,fillColor=`#00FFFF` ### errLogFile > fillColor=`#FF9090` #### File to save console error log > fillColor=`#92FF00`,mmd.emoticon=`information` ##### \err\.txt\ > fillColor=`#00FFFF` ### exec > fillColor=`#FF9090` #### Go tool to be executed > fillColor=`#92FF00`,mmd.emoticon=`information` ##### go > fillColor=`#F3F676` ###### \cgo\ > fillColor=`#00FFFF` ### enforceGoPathToEnd > fillColor=`#FF9090` #### Make GOPATH value as the last one in new generated GOPATH chain > fillColor=`#92FF00`,mmd.emoticon=`information` ##### false > fillColor=`#F3F676` ###### \true\ > fillColor=`#00FFFF` ### execSubpath > fillColor=`#FF9090` #### Sub\-path to executing go tool in SDK folder > fillColor=`#92FF00`,mmd.emoticon=`information` ##### bin > fillColor=`#F3F676` ###### \bin/sub\ > fillColor=`#00FFFF` ### echo > fillColor=`#FF9090` #### Messages to be printed as INFO into log > fillColor=`#92FF00`,mmd.emoticon=`information` ##### \
\Hello world\
\
> align=`left`,fillColor=`#00FFFF` ### echoWarn > fillColor=`#FF9090` #### Messages to be printed as WARNING into log > fillColor=`#92FF00`,mmd.emoticon=`information` ##### \
\Hello world\
\
> align=`left`,fillColor=`#00FFFF` ### filterEnvPath > fillColor=`#FF9090` #### Flag shows that environment PATH variable should be
filtered for footsteps of other go/bin folders to prevent conflicts > fillColor=`#92FF00`,mmd.emoticon=`information` ##### true > fillColor=`#F3F676` ###### \false\ > fillColor=`#00FFFF` ### goPath > fillColor=`#FF9090` #### Folder to be used as $GOPATH > fillColor=`#92FF00`,mmd.emoticon=`information` ##### defines ###### $GOPATH ##### $\{user\.home\}/\.mvnGoLang/\.go\_path > fillColor=`#F3F676` ###### \$\{user\.home\}/gopath\ > fillColor=`#00FFFF` ### goVersion > fillColor=`#FF9090` #### Go SDK version > fillColor=`#92FF00`,mmd.emoticon=`information` ##### mvn\.golang\.go\.version ##### 1\.18\.3 > fillColor=`#F3F676` ###### \1\.15\.3\ > fillColor=`#00FFFF` ### goBin > fillColor=`#FF9090` #### Folder to be used as $GOBIN > fillColor=`#92FF00`,mmd.emoticon=`information` ##### defines ###### $GOBIN ##### $\{project\.build\.directory\} > fillColor=`#F3F676` ###### \$\{basedir\}/bin\ ### goRoot > fillColor=`#FF9090` #### GoSDK home folder > fillColor=`#92FF00`,mmd.emoticon=`information` ##### \some/go/root\ > fillColor=`#00FFFF` ### goCache > fillColor=`#FF9090` #### Cache directory to keep build data > fillColor=`#92FF00`,mmd.emoticon=`information` ##### defines ###### $GOCACHE ##### $\{project\.build\.directory\}/\.goBuildCache > fillColor=`#F3F676` ###### \off\ > fillColor=`#00FFFF` ### goRootBootstrap > fillColor=`#FF9090` #### Go bootstrap home folder > fillColor=`#92FF00`,mmd.emoticon=`information` ##### defines ###### $GOROOT\_BOOTSTRAP ### hideBanner > fillColor=`#FF9090` #### Allows to hide print of plug\-in banner > fillColor=`#92FF00`,mmd.emoticon=`information` ##### true > fillColor=`#F3F676` ###### \false\ > fillColor=`#00FFFF` ### ignoreErrorExitCode > fillColor=`#FF9090` #### false > fillColor=`#F3F676` ##### \true\ > fillColor=`#00FFFF` ### keepSdkArchive > fillColor=`#FF9090` #### false > fillColor=`#F3F676` ##### \true\ > fillColor=`#00FFFF` ### keepUnarchFolderIfError > fillColor=`#FF9090` #### false > fillColor=`#F3F676` ##### \true\ > fillColor=`#00FFFF` ### moduleMode > fillColor=`#FF9090` #### Manage processing of Go modules > fillColor=`#92FF00`,mmd.emoticon=`information` ##### false > fillColor=`#F3F676` ###### properties ####### mvn\.golang\.module\.mode ##### \true\ > fillColor=`#00FFFF` ### proxy > fillColor=`#FF9090` #### host > fillColor=`#FDB576` ##### 127\.0\.0\.1 > fillColor=`#F3F676` ###### \192\.68\.23\.12\ > fillColor=`#00FFFF` #### protocol > fillColor=`#FDB576`,leftSide=`true` ##### http > fillColor=`#F3F676` ###### \https\ > fillColor=`#00FFFF` #### port > fillColor=`#FDB576`,leftSide=`true` ##### 80 > fillColor=`#F3F676` ###### \8080\ > fillColor=`#00FFFF` #### username > fillColor=`#FDB576`,leftSide=`true` ##### \somename\ > fillColor=`#00FFFF` #### password > fillColor=`#FDB576`,leftSide=`true` ##### \changeme\ > fillColor=`#00FFFF` #### nonProxyHosts > fillColor=`#FDB576`,leftSide=`true` ##### \127\.0\.0\.1|localhost\ > fillColor=`#00FFFF` ### useMavenProxy > fillColor=`#FF9090`,leftSide=`true` #### Allow use of proxy parameters
provided by maven > fillColor=`#92FF00`,mmd.emoticon=`information` ##### true > fillColor=`#F3F676` ###### \false\ > fillColor=`#00FFFF` ### supposeSdkArchiveFileName > fillColor=`#FF9090`,leftSide=`true` #### Suppose SDK archive file name if it is not presented
in the list loaded from server > fillColor=`#92FF00`,mmd.emoticon=`information` ##### true > fillColor=`#F3F676` ###### \false\ > fillColor=`#00FFFF` ### sdkSite > fillColor=`#FF9090` #### Base site for SDK download > fillColor=`#92FF00`,mmd.emoticon=`information` ##### https://storage\.googleapis\.com/golang/ > fillColor=`#F3F676` ###### \https://storage\.googleapis\.com/golang/\ > fillColor=`#00FFFF` ### skip > fillColor=`#FF9090`,leftSide=`true` #### Skip execution > fillColor=`#92FF00`,mmd.emoticon=`information` ##### properties ###### each mojo processes property > fillColor=`#00B6FF`,mmd.emoticon=`lightbulb` ####### mvn\.golang\.\[MOJO\_NAME\]\.skip > fillColor=`#F3F676` ######## \true\ > fillColor=`#00FFFF` ##### false > fillColor=`#F3F676` ###### \true\ > fillColor=`#00FFFF` ### reportsFolder > fillColor=`#FF9090`,leftSide=`true` #### Folder to place console logs > fillColor=`#92FF00`,mmd.emoticon=`information` ##### $\{project\.build\.directory\}/reports > fillColor=`#F3F676` ###### \$\{basedir\}/dir\ > fillColor=`#00FFFF` ### outLogFile > fillColor=`#FF9090`,leftSide=`true` #### File to save console out log > fillColor=`#92FF00`,mmd.emoticon=`information` ##### \console\.log\ > fillColor=`#00FFFF` ### storeFolder > fillColor=`#FF9090`,leftSide=`true` #### Folder to be used to save and unpack loaded SDKs
and also keep misc info > fillColor=`#92FF00`,mmd.emoticon=`information` ##### $\{user\.home\}/\.mvnGoLang > fillColor=`#F3F676` ###### \$\{user\.home\}/\.mvngo\ > fillColor=`#00FFFF` ### sources > fillColor=`#FF9090` #### Project source folder > fillColor=`#92FF00`,mmd.emoticon=`information` ##### $\{project\.build\.sourceDirectory\} > fillColor=`#F3F676` ###### \$\{basedir\}/src\ > fillColor=`#00FFFF` ### sdkArchiveName > fillColor=`#FF9090` #### Allows directly define name of SDK archive > fillColor=`#92FF00`,mmd.emoticon=`information` ##### \gosdk1\.12\.3\.zip\ > fillColor=`#00FFFF` ### sdkDownloadUrl > fillColor=`#FF9090` #### Directly defined URL to download GoSDK > fillColor=`#92FF00`,mmd.emoticon=`information` ##### \https://dl\.google\.com/go/go1\.13\.darwin\-amd64\.tar\.gz\ > fillColor=`#00FFFF` ### target386 > fillColor=`#FF9090`,leftSide=`true` #### Value to be provided as $GO386 > fillColor=`#92FF00`,mmd.emoticon=`information` ##### defines ###### $GO386 ##### \387\ > fillColor=`#00FFFF` ### targetArm > fillColor=`#FF9090`,leftSide=`true` #### Value to be provided as $GOARM > fillColor=`#92FF00`,mmd.emoticon=`information` ##### defines ###### $GOARM ##### \6\ > fillColor=`#00FFFF` ### targetOs > fillColor=`#FF9090`,leftSide=`true` #### Target OS information for $GOOS > fillColor=`#92FF00`,mmd.emoticon=`information` ##### defines ###### $GOOS ##### \linux\ > fillColor=`#00FFFF` ### targetArch > fillColor=`#FF9090` #### Target architecture for $GOARCH > fillColor=`#92FF00`,mmd.emoticon=`information` ##### defines ###### $GOARCH ##### \linux\ > fillColor=`#00FFFF` ### os > fillColor=`#FF9090`,leftSide=`true` #### Host OS information > fillColor=`#92FF00`,mmd.emoticon=`information` ##### \windows\ > fillColor=`#00FFFF` ### osxVersion > fillColor=`#FF9090`,leftSide=`true` #### Data about host OSX version > fillColor=`#92FF00`,mmd.emoticon=`information` ##### \osx10\.8\ fillColor=`#00FFFF` ### verbose > fillColor=`#FF9090`,leftSide=`true` #### Make verbose output, also active if maven in debug > fillColor=`#92FF00`,mmd.emoticon=`information` ##### false > fillColor=`#F3F676` ###### \true\ > fillColor=`#00FFFF` ### workingDir > fillColor=`#FF9090` #### Path to be used as working directory for executing process > fillColor=`#92FF00`,mmd.emoticon=`information` ##### \$\{basedir\}\ > fillColor=`#00FFFF` ### useGoTool > fillColor=`#FF9090`,leftSide=`true` #### Name of tool to be called
instead of standard 'go' tool > fillColor=`#92FF00`,mmd.emoticon=`information` ##### \\ > fillColor=`#00FFFF` ### useEnvVars > fillColor=`#FF9090`,leftSide=`true` #### Find and use Go environment variables > fillColor=`#92FF00`,mmd.emoticon=`information` ##### false > fillColor=`#F3F676` ###### \true\ > fillColor=`#00FFFF` ## goals > fillColor=`#C6C0D6`,leftSide=`true` ### build > fillColor=`#B772F5`,textColor=`#FFFFFF` - TOPIC
1784F737589A
#### resultFolder > fillColor=`#FF9090` ##### Target folder where to place the result file > fillColor=`#92FF00`,mmd.emoticon=`information` ###### $\{project\.build\.directory\} > fillColor=`#F3F676` ####### \some/folder\ #### resultName > fillColor=`#FF9090`,leftSide=`true` ##### Name of the result file > fillColor=`#92FF00`,mmd.emoticon=`information` ###### $\{project\.build\.finalName\} > fillColor=`#F3F676` ####### \someName\ #### buildMode > fillColor=`#FF9090`,leftSide=`true` ##### Build mode indicates which kind of object file is to be built > fillColor=`#92FF00`,mmd.emoticon=`information` ###### default > fillColor=`#F3F676` ####### \plugin\ #### strip > fillColor=`#FF9090`,leftSide=`true` ##### Strip result file > fillColor=`#92FF00`,mmd.emoticon=`information` ###### false > fillColor=`#F3F676` ####### \true\ #### ldFlags > fillColor=`#FF9090`,leftSide=`true` ##### List of linker flags > fillColor=`#92FF00`,mmd.emoticon=`information` ###### \
\\-X\
\"main\.Buildstamp=$\{build\.date\.stamp\}"\
\\-X\
\"main\.svnRevision=22543"\
\
> align=`left` #### attach > fillColor=`#FF9090` ##### Attach the result as additional artifact to be installed and deployed > fillColor=`#92FF00`,mmd.emoticon=`information` ###### properties ####### mvn\.golang\.build\.attach ###### false > fillColor=`#F3F676` ####### \true\ #### attachClassifier > fillColor=`#FF9090` ##### Define classifier for attached artifact > fillColor=`#92FF00`,mmd.emoticon=`information` ###### properties ####### mvn\.golang\.build\.attach\.classifier ###### \ > fillColor=`#F3F676` ####### \windows\ #### attachType > fillColor=`#FF9090` ##### Define type for attached artifact > fillColor=`#92FF00`,mmd.emoticon=`information` ###### properties ####### mvn\.golang\.build\.attach\.type ###### bin > fillColor=`#F3F676` ####### \exe\ #### dependencies > fillColor=`#FFCC00` - TOPIC
1693D4AFAAFA
#### packages > fillColor=`#FFCC00`,leftSide=`true` - TOPIC
1693D4A9E73A
### clean > fillColor=`#B772F5`,leftSide=`true`,textColor=`#FFFFFF` #### cleanGoPath > fillColor=`#FF9090` ##### Clean all folders provided by Go Path > fillColor=`#92FF00`,mmd.emoticon=`information` ###### false > fillColor=`#F3F676` ####### \true\ #### deleteStoreFolder > fillColor=`#FF9090`,leftSide=`true` ##### Delete plugin Golang store folder > fillColor=`#92FF00`,mmd.emoticon=`information` ###### false > fillColor=`#F3F676` ####### \true\ #### packages > fillColor=`#FFCC00`,leftSide=`true` - TOPIC
1693D4A9E73A
#### dependencies > fillColor=`#FFCC00` - TOPIC
1693D4AFAAFA
### custom > fillColor=`#B772F5`,leftSide=`true`,textColor=`#FFFFFF` #### customCommand > fillColor=`#FF9090` ##### Command for Go tool to execute > fillColor=`#92FF00`,mmd.emoticon=`information` ###### \dist\ #### dependencies > fillColor=`#FFCC00` - TOPIC
1693D4AFAAFA
#### packages > fillColor=`#FFCC00`,leftSide=`true` - TOPIC
1693D4A9E73A
### fix > fillColor=`#B772F5`,leftSide=`true`,textColor=`#FFFFFF` - TOPIC
1784F737589A
#### packages > fillColor=`#FFCC00`,leftSide=`true` - TOPIC
1693D4A9E73A
#### dependencies > fillColor=`#FFCC00` - TOPIC
1693D4AFAAFA
### fmt > fillColor=`#B772F5`,leftSide=`true`,textColor=`#FFFFFF` #### packages > fillColor=`#FFCC00`,leftSide=`true` - TOPIC
1693D4A9E73A
#### dependencies > fillColor=`#FFCC00` - TOPIC
1693D4AFAAFA
### generate > fillColor=`#B772F5`,leftSide=`true`,textColor=`#FFFFFF` - TOPIC
1784F737589A
#### dependencies > fillColor=`#FFCC00` - TOPIC
1693D4AFAAFA
#### packages > fillColor=`#FFCC00` - TOPIC
1693D4A9E73A
### get > fillColor=`#B772F5`,leftSide=`true`,textColor=`#FFFFFF` - TOPIC
1784F737589A
#### allowLockSession > fillColor=`#FF9090` ##### Enable lock maven session during operation
if maven in parallel mode > fillColor=`#92FF00`,mmd.emoticon=`information` ###### true > fillColor=`#F3F676` ####### \false\ > fillColor=`#F3F676` #### customScript > fillColor=`#FF9090` ##### Script to be called in the end of all operations over CVS > fillColor=`#92FF00`,mmd.emoticon=`information` ###### path > fillColor=`#FDB576` ####### \$\{basedir\}/script\.sh\ ###### options > fillColor=`#FDB576` ####### \
\arg1\
\arg2\
\
> align=`left` ###### ignoreFail > fillColor=`#FDB576` ####### \false\ ###### environment
variables > fillColor=`#FDB576` ####### MVNGO\_CVS\_BRANCH ####### MVNGO\_CVS\_TAG > leftSide=`true` ####### MVNGO\_CVS\_REVISION > leftSide=`true` ####### MVNGO\_CVS\_PACKAGE > leftSide=`true` #### externalPackageFile > fillColor=`#FF9090`,leftSide=`true` ##### Path to a file contains list of packages > fillColor=`#92FF00`,mmd.emoticon=`information` ###### mvn\.golang\.get\.packages\.file ###### \$\{basedir\}/packages\.txt\ > fillColor=`#00FFFF` #### autofixGitCache > fillColor=`#FF9090`,leftSide=`true` ##### Try to fix GIT cache error if it is detected > fillColor=`#92FF00`,mmd.emoticon=`information` ###### false > fillColor=`#F3F676` ####### \true\ > fillColor=`#00FFFF` #### branch > fillColor=`#FF9090`,leftSide=`true` ##### Branch to be activated > fillColor=`#92FF00`,mmd.emoticon=`information` ###### \v1\.2\.3\ > fillColor=`#00FFFF` #### tag > fillColor=`#FF9090`,leftSide=`true` ##### Tag to be activated > fillColor=`#92FF00`,mmd.emoticon=`information` ###### \1\.0\.0\ > fillColor=`#00FFFF` #### revision > fillColor=`#FF9090`,leftSide=`true` ##### Revision to be activated > fillColor=`#92FF00`,mmd.emoticon=`information` ###### \12233445\ > fillColor=`#00FFFF` #### customCvsOptions > fillColor=`#FF9090`,leftSide=`true` ##### Allows to define custom options for CVS operation > fillColor=`#92FF00`,mmd.emoticon=`information` ###### \
\\-\-paginate\
\\-\-no\-replace\-objects\
\
> fillColor=`#00FFFF` #### cvsExe > fillColor=`#FF9090`,leftSide=`true` ##### Custom executable CVS file to be executed for branch,
tag and revision operations > fillColor=`#92FF00`,mmd.emoticon=`information` ###### \somecvs\.exe\ > fillColor=`#00FFFF` #### enforceDeletePackageFiles > fillColor=`#FF9090`,leftSide=`true` ##### Search sources for package and its compiled version,
enforce delete of found source folder and compiled '\.a' file > fillColor=`#92FF00`,mmd.emoticon=`information` ###### false > fillColor=`#F3F676` ####### \true\ > fillColor=`#00FFFF` #### deleteCommonPkg > fillColor=`#FF9090`,leftSide=`true` ##### Delete whole common pkg folder at $GOPATH/pkg > fillColor=`#92FF00`,mmd.emoticon=`information` ###### false > fillColor=`#F3F676` ####### \true\ > fillColor=`#00FFFF` #### relativePathToCvsFolder > fillColor=`#FF9090`,leftSide=`true` ##### Allows directly define relative path
to the package containing CVS data
inside 'src' folder for package > fillColor=`#92FF00`,mmd.emoticon=`information` #### disableCvsAutosearch > fillColor=`#FF9090`,leftSide=`true` ##### Disable auto\-search for CVS folder in package folder hierarchy > fillColor=`#92FF00`,mmd.emoticon=`information` ###### false > fillColor=`#F3F676` ####### \true\ > fillColor=`#00FFFF` #### dependencies > fillColor=`#FFCC00` - TOPIC
1693D4AFAAFA
#### packages > fillColor=`#FFCC00` - TOPIC
1693D4A9E73A
### list > fillColor=`#B772F5`,leftSide=`true`,textColor=`#FFFFFF` - TOPIC
1784F737589A
#### format > fillColor=`#FF9090` ##### alternate format for the list > fillColor=`#92FF00`,mmd.emoticon=`information` ###### \ > fillColor=`#F3F676` ####### \\{\{ join \.Deps "\\n"\}\}\ > fillColor=`#00FFFF` #### json > fillColor=`#FF9090`,leftSide=`true` ##### causes the package data to be printed in JSON format > fillColor=`#92FF00`,mmd.emoticon=`information` ###### false > fillColor=`#F3F676` ####### \true\ > fillColor=`#00FFFF` #### listModules > fillColor=`#FF9090`,leftSide=`true` ##### causes list to list modules instead of packages > fillColor=`#92FF00`,mmd.emoticon=`information` ###### false > fillColor=`#F3F676` ####### \true\ > fillColor=`#00FFFF` ### install > fillColor=`#B772F5`,leftSide=`true`,textColor=`#FFFFFF` - TOPIC
1784F737589A
#### skip > fillColor=`#FF9090` ##### Skip step execution > fillColor=`#92FF00`,mmd.emoticon=`information` ###### maven\.deploy\.skip ####### false > fillColor=`#F3F676` ######## \true\ > fillColor=`#00FFFF` #### dependencies > fillColor=`#FFCC00` - TOPIC
1693D4AFAAFA
#### packages > fillColor=`#FFCC00` - TOPIC
1693D4A9E73A
### jfrog\-cli > fillColor=`#B772F5`,leftSide=`true`,textColor=`#FFFFFF` #### cliPath > fillColor=`#FF9090` ##### Path to a JFrog CLI executable file > fillColor=`#92FF00`,mmd.emoticon=`information` ###### \$\{basedir\}/jfrog\ > fillColor=`#00FFFF` #### target > fillColor=`#FF9090`,leftSide=`true` ##### The product on which you wish to execute the command > fillColor=`#92FF00`,mmd.emoticon=`information` ###### rt > fillColor=`#F3F676` ####### \rt\ > fillColor=`#00FFFF` #### command > fillColor=`#FF9090`,leftSide=`true` ##### The command to execute > fillColor=`#92FF00`,mmd.emoticon=`information` ###### go > fillColor=`#F3F676` ####### \go\ > fillColor=`#00FFFF` #### arguments > fillColor=`#FF9090`,leftSide=`true` ##### Set of arguments corresponding to the command > fillColor=`#92FF00`,mmd.emoticon=`information` ###### \
\\
\\
\
> fillColor=`#00FFFF` #### dependencies > fillColor=`#FFCC00` - TOPIC
1693D4AFAAFA
### mod > fillColor=`#00B6FF`,leftSide=`true`,textColor=`#FFFFFF` - TOPIC
1784F737589A
#### command > fillColor=`#FF9090` ##### Command to be executed > fillColor=`#92FF00`,mmd.emoticon=`information` ###### \init\ > fillColor=`#00FFFF` #### arguments > fillColor=`#FF9090`,leftSide=`true` ##### Optional command arguments > fillColor=`#92FF00`,mmd.emoticon=`information` ###### \
\example\.com/hello\
\
> align=`left`,fillColor=`#00FFFF` #### dependencies > fillColor=`#FFCC00`,leftSide=`true` - TOPIC
1693D4AFAAFA
### mvninstall > fillColor=`#B772F5`,leftSide=`true`,textColor=`#FFFFFF` #### compression > fillColor=`#FF9090` ##### Compression level of zip file\. Must be 1\.\.9 > fillColor=`#92FF00`,mmd.emoticon=`information` ###### 9 > fillColor=`#F3F676` ####### \5\ > fillColor=`#00FFFF` #### dependencies > fillColor=`#FFCC00` - TOPIC
1693D4AFAAFA
### run > fillColor=`#B772F5`,leftSide=`true`,textColor=`#FFFFFF` - TOPIC
1784F737589A
#### xprog > fillColor=`#FF9090` ##### If value is provided then \-exec will be used with the value > fillColor=`#92FF00`,mmd.emoticon=`information` ###### \some\ > fillColor=`#00FFFF` #### args > fillColor=`#FF9090`,leftSide=`true` ##### Command arguments\. They follow package names in command line > fillColor=`#92FF00`,mmd.emoticon=`information` ###### \
\\-v\
\
> align=`left`,fillColor=`#00FFFF` #### dependencies > fillColor=`#FFCC00` - TOPIC
1693D4AFAAFA
#### packages > fillColor=`#FFCC00` - TOPIC
1693D4A9E73A
### test > fillColor=`#B772F5`,leftSide=`true`,textColor=`#FFFFFF` - TOPIC
1784F737589A
#### testFlags > fillColor=`#FF9090` ##### List of test binary flags > fillColor=`#92FF00`,mmd.emoticon=`information` ###### \
\\-test\.cpuprofile=prof\.out\
\
> align=`left`,fillColor=`#00FFFF` #### skip > fillColor=`#FF9090`,leftSide=`true` ##### Skip the step > fillColor=`#92FF00`,mmd.emoticon=`information` ###### properties ####### maven\.test\.skip ####### skipTests ###### false > fillColor=`#F3F676` ####### \true\ > fillColor=`#00FFFF` #### dependencies > fillColor=`#FFCC00` - TOPIC
1693D4AFAAFA
#### packages > fillColor=`#FFCC00` - TOPIC
1693D4A9E73A
### tool > fillColor=`#B772F5`,leftSide=`true`,textColor=`#FFFFFF` #### command > fillColor=`#FF9090` ##### Command to be executed > fillColor=`#92FF00`,mmd.emoticon=`information` ###### \foo\ > fillColor=`#00FFFF` #### args > fillColor=`#FF9090`,leftSide=`true` ##### Command arguments > fillColor=`#92FF00`,mmd.emoticon=`information` ###### \
\\-a\
\\-v\
\
> align=`left`,fillColor=`#00FFFF` #### dependencies > fillColor=`#FFCC00` - TOPIC
1693D4AFAAFA
### vet > fillColor=`#B772F5`,leftSide=`true`,textColor=`#FFFFFF` - TOPIC
1784F737589A
#### packages > fillColor=`#FFCC00` - TOPIC
1693D4A9E73A
#### dependencies > fillColor=`#FFCC00` - TOPIC
1693D4AFAAFA
================================================ FILE: CHANGELOG.md ================================================ # __2.3.10 (08-jun-2022)__ - updated dependencies - default GoSDK version is 1.19 # __2.3.9 (04-jul-2021)__ - fix for clean fail for multi-module project if some artifacts unresolvable [#90](https://github.com/raydac/mvn-golang/issues/90) - fix for seldom error "Can't create temp folder" when building modules concurrently [#88](https://github.com/raydac/mvn-golang/issues/88) - default GoSDK version is 1.16.5 - added autodetect for aarch64 [#87](https://github.com/raydac/mvn-golang/issues/87) # __2.3.8 (22-mar-2021)__ - improved maven archetypes - default GoSDK version is 1.16.2 - added [Azul3D](https://azul3d.org/) and [Oak](https://github.com/oakmound/oak) build examples - added `list` mojo wrapping `go list` - added `mod` property for module aware commands - go.sum excluded from delete during build by default [#84](https://github.com/raydac/mvn-golang/issues/84) - minor refactoring # __2.3.7 (22-feb-2021)__ - refactoring, improved informing about file log state [#83](https://github.com/raydac/mvn-golang/issues/83) - improved `build` mojo, added support to attach build result as project artifact[#82](https://github.com/raydac/mvn-golang/issues/82) - default version of GoSDK updated to 1.15.8 - fixed slash processing in go.mod under windows [#80](https://github.com/raydac/mvn-golang/issues/80) ( thanks [fmazoyer](https://github.com/fmazoyer)) # __2.3.6 (19-dec-2020)__ - improved restoration of `go.mod` and `go.sum` state after build - refactoring and minor bugfixing - updated dependencies - default version of GoSDK updated to 1.15.6 # __2.3.5 (12-sep-2020)__ - fixed bug in go.mod backup restore [#73](https://github.com/raydac/mvn-golang/issues/73) - default version of GoSDK updated to 1.15.2 # __2.3.4 (05-nov-2019)__ - improved host arch detection [#70](https://github.com/raydac/mvn-golang/issues/70) - default version of GoSDK updated to 1.13.4 - minor refactoring # __2.3.3 (30-jul-2019)__ - improved work in parallel mode - __minimal supported JDK version increased to 1.8__ - added `mod` mojo - added unified boolean properties `mvn.golang..skip` to skip work of selected mojo [#65](https://github.com/raydac/mvn-golang/issues/65) - text `none` in `resultName` field of `build` mojo disables auto-adding of `-o` command line option - minor fixes and refactoring - added parameter `workingDir` to replace automatically choosen working directory during tool execution. - added support of [Golang modules]() with maven dependencies, added [example](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-maven-module-mix) [#60](https://github.com/raydac/mvn-golang/issues/60) - default version of GoSDK updated to 1.12.7 # __2.3.2 (24-jun-2019)__ - updated maven archetypes - fixed `mvn-golang:vet does not have maven dependency resolution` [#59](https://github.com/raydac/mvn-golang/issues/59) - default version of GoSDK updated to 1.12.6 # __2.3.1 (14-apr-2019)__ - default version of GoSDK updated to 1.12.4 - added parameter `goCache` to provide `GOCACHE` environment variable, the default value is `${project.build.directory}/.goBuildCache` # __2.3.0 (02-mar-2019)__ - __added support of work with mvn-golang dependencies in maven repository, so now they can be used as just maven dependencies, it can be disabled through `scanDependencies` property. [example](./mvn-golang-examples/mvn-golang-example-maven-repository)__ - __repository artifact extension changed to `zip` to provide way to be processed by standard maven plugins__ - added support of system properties 'mvngo.skip' and `mvngo.disable.ssl.check` - added `jfrog-cli` mojo to provide way make call to external [JFrog CLI](https://www.jfrog.com/confluence/display/CLI/JFrog+CLI) in tuned Go SDK environment, [example](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-jfrog-cli). - added `connectionTimeout` property to provide timeout (milliseconds) for HTTP connections, default 60000 ms - [#55](https://github.com/raydac/mvn-golang/issues/55) print log error stream into debug if command status is not error - added check of hash for downloaded SDK archive, can be disabled by `false` in parameter `checkSdkHash`, it checks hash provided in response header `x-goog-hash` - improved GoSDK loading # 2.2.0 (13-may-2018) - added property `mvn.golang.go.version` to define value for `goVersion` configuration parameter, it allows decrease configuration section dramatically - added `externalPackageFile` (property `mvn.golang.get.packages.file`) option to the `get` mojo, it allows to keep package list in external file - default value of the `useMavenProxy` flag is changed to __true__ to make the plugin more compatible with default maven process # 2.1.8 (29-apr-2018) - added support of `maven.deploy.skip` and `maven.install.skip` prperties in `install` and `deploy` mojos - [#48](https://github.com/raydac/mvn-golang/issues/48) improved processing of `install` and `deploy` to be more compatible with standard maven process - fixed dependency for [termui test project in examples](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-termui) - added `customScript` section into `get` to execute some custom script over package CVS folder # 2.1.7 (18-feb-2018) - fixed target file extension in maven archetypes [#44](https://github.com/raydac/mvn-golang/issues/44) - added `target386` to provide value for `$GO386` environment variable - improved GOPATH value processing, multi-folder value allowed - added flag to disable SSL certificate check for HTTPS connections, `disableSSLcheck`, by default it is `false` - improved Golang SDK list load [#24](https://github.com/raydac/mvn-golang/issues/24) - added `args` attribute to the `run` mojo to provide tail command line arguments. - added processing of maven session offline mode - improved proxy server settings processing to process NTLM authorisation - removed maven-enforcer-plugin because it throws NPE for old maven versions # 2.1.6 (27-aug-2017) - implemented file locker to synchronize SDK loading between JVM processes, if cache folder is shared - improved `get` mojo behavior during branch, tag and revision processing - improved `get` mojo, added `deleteCommonPkg` flag to delete whole common `pkg` folder, by default false - improved logging - added property `supposeSdkArchiveFileName` to suppose SDK archive file name if it is not presented in common SDK list, active by default - minimal version of Java increased to 1.7 # 2.1.5 (03-jul-2017) - added archetype for multimodule project `mvn-golang-hello-multi` - added `customCvsOptions` into `get` mojo to provide custom options for CVS operation. - improved `get` mojo, added auto-search of CVS folder in package folder hierarchy, it can be disabled with `true`, #23 - improved `get` mojo, added way to define relative path to CVS folder in `src` folder through ``, by default the path extracted from package name # 2.1.4 (24-jun-2017) - added support of BAZAAR CVS (experimental) - fixed order of processing of CVS branch, tag and revision in `get` mojo - added `enforceDeletePackageFiles` flag into `get` mojo to enforce deletion of package sources and compiled version in local repository - fixed processing of `revision` for CVS # 2.1.3 (14-apr-2017) - Improved `go-hello-test` archetype to generate [Intellij Idea Go plugin project structure](https://plugins.jetbrains.com/plugin/5047-go-language-golang-org-support-plugin) - Added flag `enforceGoPathToEnd` to enforce changing of folder list order in new generated GOPATH - Added list parameter `ldFlags` for `buildMojo` to define linker flags. - Added boolean flag `strip` for `buildMojo` to remove symbol table and DWARF from the result file. - Added parameter `buildMode` for `buildMojo` to define [Go build mode](https://golang.org/cmd/go/#hdr-Description_of_build_modes) # 2.1.2 (07-nov-2016) - Added `skip` attribute to skip execution of mojo - [#10](https://github.com/raydac/mvn-golang/issues/10), Added way to disable providing of $GOBIN through pseudo-path __NONE__ - Changed maven phase for build from `compile` to `package` (to prevent build start before tests) - Enforced console output for `test` even in non-verbose mode - Added default packages `./...` for `fmt`,`vet`,`fix` and `test` tasks - Added `maven.test.failure.ignore` and `test` properties processing into `test` goal, also allowed method regex template after `#` like in surefire # 2.1.1 (21-aug-2016) - [#9](https://github.com/raydac/mvn-golang/issues/9), Added attribute `targetArm` to provide $GOARM value - Added support of proxy server [#8](https://github.com/raydac/mvn-golang/issues/8), added flag `useMavenProxy` to use proxy server defined either through maven settings.xml file or the `proxy` configuration section of the plugin. - Improved `clean` mojo, added flags to clean Go path folder defined through `goPath` parameter, and added flag to delete whole `storeFolder` - Added flag `ignoreErrorExitCode` to prevent failure for error exit code, it is useful in some test cases. - Added parameter `reportsFolder` to define folder where some reports will be placed. - Added parameters `outLogFile` and `errLogFile` to save execution console log as files in the report folder. By default such reports are not saved. - Console log for `test` will be shown in maven log only in verbose mode # 2.1.0 (28-may-2016) - Output of environment variables has been moved under the `verbose` flag - __Added `mvninstall` goal which saves artifact into local maven repository during `install` phase,[#2 request](https://github.com/raydac/mvn-golang/issues/2)__ - __Added support of branches and tags into `get`, it works for Git, Hg and SVN repositories__ - Improved archetype template, added example of test - __Fixed issue [#3 "cannot run tests"](https://github.com/raydac/mvn-golang/issues/3)__ # 2.0.0 (17-apr-2016) - __Added maven archetype `mvn-golang-hello` to generate minimal GoLang "Hello World!" project__ - Added mojo for `run` command. - __Removed `` property because the logic of search executable file has been reworked__ - Added `goBin` parameter to provide $GOBIN value - Improved CLEAN to delete also the project target folder - The Banner is hidden by default - __Changed project folder structure to be closer to GoLang projects__ - __Added life-cycle for packaging `mvn-golang` with support of the standard GoLang project hierarchy, as example see adapted [the Hello world example for the case](https://github.com/raydac/mvn-golang/blob/master/mvn-golang-examples/mvn-golang-example-helloworld/pom.xml)__ - Improved logging of command console output, now it is split to lines and every line logged separately - Added support for loading of archives with Content-type `application/x-gzip` - Increased number of test examples - Build of example applications moved to the special profile `examples` # 1.1.0 (05-apr-2016) - Added [test example for `gomobile` for Android ARM 7](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-gomobile) - Added ``, it allows to find golang tool in $GOPATH instead of $GOROOT (by default `false`) - Added `` and `` to print echo messages into maven log - Added `` parameter to define gotool name (by default `go`) - Added `` parameter to provide sub-path in SDK root to find golang tool (by default `bin`) - Renamed parameter `` to `` and `` to `` for `build` - Fixed racing issue for the maven `-T4` flag - Fixed "Truncated TAR archive exception" for Mac OS tar.gz archive - Removed predefined values for `` and `` - Minor refactoring # 1.0.0 (26-mar-2016) - initial version ================================================ FILE: LICENSE ================================================ Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: README.md ================================================ ![mvn-golang](assets/git_banner.png) > [!WARNING] > I have archived this project because Golang has changed significantly since 2016, making maintenance too complex and costly. I am sure that Go's build process will continue to evolve, so I have started a lightweight alternative: [gosdk-wrapper-maven-plugin](https://github.com/raydac/gosdk-wrapper-maven-plugin). This new plugin is designed to provide a highly flexible mechanism that remains compatible with future changes and focuses solely on downloading GoSDK and invoking its tools. [![License Apache 2.0](https://img.shields.io/badge/license-Apache%20License%202.0-green.svg)](http://www.apache.org/licenses/LICENSE-2.0) [![Java 8.0+](https://img.shields.io/badge/java-8.0%2b-green.svg)](http://www.oracle.com/technetwork/java/javase/downloads/index.html) [![Maven central](https://maven-badges.herokuapp.com/maven-central/com.igormaznitsa/mvn-golang-wrapper/badge.svg)](http://search.maven.org/#artifactdetails|com.igormaznitsa|mvn-golang-wrapper|2.3.10|jar) [![Maven 3.0.3+](https://img.shields.io/badge/maven-3.0.3%2b-green.svg)](https://maven.apache.org/) [![PayPal donation](https://img.shields.io/badge/donation-PayPal-cyan.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AHWJHJFBAWGL2) [![YooMoney donation](https://img.shields.io/badge/donation-Yoo.money-blue.svg)](https://yoomoney.ru/to/41001158080699) # Changelog __ARCHIVED (03-mar-2025)__ __2.3.10 (08-jun-2022)__ - updated dependencies - default GoSDK version is 1.19 __2.3.9 (04-jul-2021)__ - fix for clean fail for multi-module project if some artifacts unresolvable [#90](https://github.com/raydac/mvn-golang/issues/90) - fix for seldom error "Can't create temp folder" when building modules concurrently [#88](https://github.com/raydac/mvn-golang/issues/88) - default GoSDK version is 1.16.5 - added autodetect for aarch64 [#87](https://github.com/raydac/mvn-golang/issues/87) [full changelog](https://github.com/raydac/mvn-golang/blob/master/CHANGELOG.md) # GO start! __Taste Go in just two commands!__ ``` mvn archetype:generate -B -DarchetypeGroupId=com.igormaznitsa -DarchetypeArtifactId=mvn-golang-hello -DarchetypeVersion=2.3.10 -DgroupId=com.go.test -DartifactId=gohello -Dversion=1.0-SNAPSHOT mvn -f ./gohello/pom.xml package ``` The First command in th snippet above generates a maven project with some test files and the second command builds the project. [Also you can take a look at the example `Hello world` project using the plugin](https://github.com/raydac/mvn-golang-example) If you want to generate a multi-module project, then you can use such snippet ``` mvn archetype:generate -B -DarchetypeGroupId=com.igormaznitsa -DarchetypeArtifactId=mvn-golang-hello-multi -DarchetypeVersion=2.3.10 -DgroupId=com.go.test -DartifactId=gohello-multi -Dversion=1.0-SNAPSHOT ``` # Introduction The Plug-in just wraps Golang tool-chain and allows to use strong maven based infrastructure to build Golang projects. It also can automatically download needed Golang SDK from the main server and tune needed version of packets for their branch, tag or revisions. Because a Golang project in the case is formed as just maven project, it is possible to work with it in any Java IDE which supports Maven. ![mvn-golang-wrapper](https://raw.githubusercontent.com/raydac/mvn-golang/master/assets/doc_common.png) # How it works On start the plug-in makes below steps: - analyzing the current platform to generate needed distributive name (it can be defined directly through properties) - check that needed Golang SDK is already cached, if it is not cached then needed SDK will be loaded and unpacked from the main Golang SDK site - execute needed go lang tool `bin/go` with defined command, the source folder will be set as current folder - all folders of the project which are visible for maven (source folder, test folder, resource folders and test resource folders) are archived in ZIP file and the file is saved as a maven artifact into local maven repository (or remote maven repository). The generated ZIP artifact also contains information about dependencies which can be recognized by the plugin. In opposite to Java, Golang produces platform-dependent artifacts so that it doesn't make sense to share them through maven central but only resources and sources. # How to build Because it is maven plugin, to build the plugin just use ``` mvn clean install -Pplugin ``` To save time, examples excluded from the main build process and activated through special profile ``` mvn clean install -Pexamples ``` # Important note about automatic Golang SDK load If you have some problems with certificates during Golang SDK load, then just add `true` into plugin configuration to ignore check of certificates (also you can use property 'mvn.golang.disable.ssl.check'). Also it allows property `mvn.golang.disable.ssl.check` to disable SSL certificate check during network actions. # How to add the plugin into maven project? Below described build section for simple golang project which keeps source in `src` forlder and result should be placed into `bin` folder. Because it is golang project and mvn-golang plugin provides its own lifecycle, packaging for the project should be `mvn-golang` ```xml ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper 2.3.10 true run main.go ``` # Work with dependencies ## Dependencies from Maven repository (since 2.3.0) Plugin supports work with maven repository and can install and load dependencies from there. Artifacts generated by the plugin saved in maven respository as zip archives and `mvn-golang` must be used as `type`. ```xml com.igormaznitsa mvn-go-test-lib 1.0.0-SNAPSHOT mvn-golang ``` Plugin makes some trick in work with Maven Golang dependencies, it downloads Golang artifacts from repository and unpack them into temporary folder, then all unpacked dependencies are added to `$GOPATH`. You can take a look at [example project which has two level dependency hierarchy](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-maven-repository). Dependency mechanism is enabled by default for all goals which need it, but it can be off with `false`. If there is any conflicts or errors in Golang for Go modules then you can turn off Go modules with ```xml off ``` __Keep in mind that it is impossible use links to Github and Bitbucket libraries through `` maven mechanism, links to such dependencies should be processed by standard `GET` command and information about it you can find below.__ ## Support of Module mode Since 2.3.3 version, plug-in supports Golang module mode and allows to mix modules and work with golang maven dependencies, [I have made some sample to show the possibility](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-maven-module-mix). By default support of module mode is turned off, but it can be turned on through `true` or property `mvn.golang.module.mode`. ## Wrapped GET command Plugin provides wrapper for Golang GET command and you can just define some external file contains package info through system property `mvn.golang.get.packages.file`, the file will be loaded and parsed and its definitions will be added into package dependencies. Format of the file is very easy. Each package described on a line in format `package: [,branch: ][,tag: ][,revision: ]` also it supports single line comments through `//` and directive `#include ` to load packages from some external file. Also it supports interpolation of properties defined in format `${property.name}` and provide access to maven, system and environment variables. Example: ``` // example package file #include "${basedir}/external/file.txt" package:github.com/maruel/panicparse,tag:v1.0.2 // added because latest changes in panicparse is incompatible with termui package:github.com/gizak/termui,branch:v2 ``` This mechanism just makes work with dependencies easier and if you want to provide some specific flags and scripts to process CVS folders you have to define configuration parameters in pom.xml, packages defined in the external file and in the pom.xml will be mixed. The Plug-in doesn't work with standard maven dependencies and they must be defined through task of the plugin, the example of easiest case of dependencies is ```xml default-get github.com/gizak/termui github.com/kataras/iris ``` it will be executed as `bin/go get github.com/gizak/termui github.com/kataras/iris` If you want work with specific branch then use below snipet ```xml default-get -u github.com/gizak/termui v2 ``` if you want to have several dependencies with different tag and branch then take a look at the snipet below ```xml dependency1 get github.com/some/framework 1.0.1 dependency2 get github.com/some/another v2 ``` sometime GIT can produce cache errors and in the case you can try to turn on auto-fix of such errors with `true` flag. # How to save generated artifact in repository? By default, artifact will be installed into maven repository automatically during `install` phase if you want to turn off artifact installation then you can use standard maven properties ```xml true true ``` or disable plugin mojo execution ```xml default-mvninstall none ``` # Configuration About configuration parameters, you can read at [the wiki page](https://github.com/raydac/mvn-golang/wiki/PluginConfigParameters). # Testing The Wrapper just wraps calls to Go tool and recognize the exit code, if call of `go test` is non-zero then build will be failed, it doesn't make any analysing of test reports! Sometime it is useful to use [GoConvey](https://github.com/smartystreets/goconvey) tool for testing, in the case use snippet below to add dependency and make testing verbose ```xml default-get -u github.com/smartystreets/goconvey default-test -v ``` # Some Examples - __[Protobuf use example](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-protobuf)__ - __[Maven repository dependencies example](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-maven-repository)__ - __[Maven repository dependencies together with modules example](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-maven-module-mix)__ - __[Versioning of dependencies](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/test-git-cvs)__ - __["Hello world!" console application.](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-helloworld)__ - __[Console application with embedded text resource prepared with the `go-bindata` utility.](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-genbindata)__ - __[Console application with `termui` library (it needs installation of some native libraries!).](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-termui)__ - __[NES emulator.](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-nes)__ - __[ANTLR usage.](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-antlr)__ - __[Multimodule project.](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-multimodule)__ - __[Preprocessing.](https://github.com/raydac/mvn-golang/tree/master/mvn-golang-examples/mvn-golang-example-preprocessing)__ ================================================ FILE: mvn-golang-examples/mvn-golang-example-azul3d-mandelbrot/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-azul3d-mandelbrot 1.0.0-SNAPSHOT mvn-golang Azul3d mandelbrot example Example of Azul3d mandelbrot project build. ${basedir}${file.separator}src ${basedir}${file.separator}bin org.apache.maven.plugins maven-resources-plugin 3.2.0 copy-resources package copy-resources ${project.build.directory} ${project.basedir}${file.separator}resources com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} true mod default-fix none ================================================ FILE: mvn-golang-examples/mvn-golang-example-azul3d-mandelbrot/resources/azul3d_mandel/mandel.frag ================================================ #version 120 varying vec2 tc0; uniform sampler2D Texture0; void main() { gl_FragColor = texture2D(Texture0, tc0); } ================================================ FILE: mvn-golang-examples/mvn-golang-example-azul3d-mandelbrot/resources/azul3d_mandel/mandel.vert ================================================ #version 120 attribute vec3 Vertex; attribute vec2 TexCoord0; varying vec2 tc0; void main() { tc0 = TexCoord0; gl_Position = vec4(Vertex, 1.0); } ================================================ FILE: mvn-golang-examples/mvn-golang-example-azul3d-mandelbrot/src/azul3d_mandel.go ================================================ // Copyright 2014 The Azul3D Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Example - Generates a mandelbrot on the CPU and displays it with the GPU. package main import ( "image" "image/color" "image/png" "log" "math" "os" "azul3d.org/engine/gfx" "azul3d.org/engine/gfx/gfxutil" "azul3d.org/engine/gfx/window" "azul3d.org/engine/keyboard" "azul3d.org/engine/mouse" "azul3d.org/examples/abs" ) // mandelGen is a mandelbrot texture generator. type mandelGen struct { // The channel of generated mandelbrot images. Only the last one received // over this channel is valid. Image chan image.Image x, y float64 // Center, e.g. x=-0.5, y=0. zoom float64 // Zoom, e.g. 1.0. resolution int // Resolution divisor, e.g. 8. maxIter int // Maximum number of generator iterations, e.g. 1000. needUpdate bool // Whether or not we should generate an updated image. bounds image.Rectangle // The framebuffer's bounding rectangle. } // handle is called to handle a window event. func (m *mandelGen) handle(e window.Event) { switch ev := e.(type) { case window.FramebufferResized: m.bounds = image.Rect(0, 0, ev.Width, ev.Height) case mouse.ButtonEvent: if ev.Button == mouse.Right && ev.State == mouse.Down { m.resolution += 2 if m.resolution > 8 { m.resolution = 4 } m.needUpdate = true } case mouse.Scrolled: m.zoom += ev.Y * 0.06 * math.Abs(m.zoom) m.needUpdate = true case window.CursorMoved: if ev.Delta { m.x += (ev.X / 900.0) / math.Abs(m.zoom) m.y += (ev.Y / 900.0) / math.Abs(m.zoom) m.needUpdate = true } } } // generate is a small helper function to call Mandelbrot and insert a small // red square into the image. It then submits the image over the channel. func (m *mandelGen) generate() { width := m.bounds.Dx() / m.resolution height := m.bounds.Dy() / m.resolution mbrot := Mandelbrot(width, height, m.maxIter, m.zoom, m.x, m.y) // Insert a small red square in the top-left of the image for ensuring // proper orientation exists in textures (this is just for testing). for x := 0; x < 5; x++ { for y := 0; y < 5; y++ { mbrot.Set(x, y, color.RGBA{255, 0, 0, 255}) } } m.Image <- mbrot } // run is the mandelbrot generation goroutine. It listens for window events and // responds by generating new mandelbrot images if needed. func (m *mandelGen) run(w window.Window) { // generate the initial mandelbrot image right now. m.generate() // Have the window notify us of specific events. evMask := window.MouseEvents evMask |= window.MouseScrolledEvents evMask |= window.FramebufferResizedEvents evMask |= window.CursorMovedEvents event := make(chan window.Event, 256) w.Notify(event, evMask) // Wait for window events. for { // Wait for one window event now. m.handle(<-event) // Handle as many window events as possible now. We do this because // generating mandelbrot images on the CPU is expensive, so we only // want to do it for the very last event. window.Poll(event, m.handle) // If we need to update, generate the next mandelbrot image. if m.needUpdate { m.needUpdate = false m.generate() } } } // newMandelGen returns a new mandelbrot generator. func newMandelGen(w window.Window, d gfx.Device) *mandelGen { m := &mandelGen{ Image: make(chan image.Image), x: -.5, y: 0, zoom: 1, resolution: 8, maxIter: 1000, bounds: d.Bounds(), } // Spawn the mandelbrot generation goroutine. go m.run(w) return m } // gfxLoop is responsible for drawing things to the window. func gfxLoop(w window.Window, d gfx.Device) { // Create a new mandelbrot generator. gen := newMandelGen(w, d) // Read the GLSL shaders from disk. shader, err := gfxutil.OpenShader(abs.Path("azul3d_mandel/mandel")) if err != nil { log.Fatal(err) } // Create a card mesh. cardMesh := gfx.NewMesh() cardMesh.Vertices = []gfx.Vec3{ // Left triangle. {-1, 1, 0}, // Left-Top {-1, -1, 0}, // Left-Bottom {1, -1, 0}, // Right-Bottom // Right triangle. {-1, 1, 0}, // Left-Top {1, -1, 0}, // Right-Bottom {1, 1, 0}, // Right-Top } cardMesh.TexCoords = []gfx.TexCoordSet{ { Slice: []gfx.TexCoord{ // Left triangle. {0, 0}, {0, 1}, {1, 1}, // Right triangle. {0, 0}, {1, 1}, {1, 0}, }, }, } // Create the texture that will display the image. We could use DXT texture // compression normally here, but because we want to download the texture // back to the CPU we must not. tex := gfx.NewTexture() tex.MinFilter = gfx.Nearest tex.MagFilter = gfx.Nearest tex.KeepDataOnLoad = true tex.Source = <-gen.Image // Wait for the first image to be generated. // Create a card object. card := gfx.NewObject() card.State = gfx.NewState() card.Shader = shader card.Textures = []*gfx.Texture{tex} card.Meshes = []*gfx.Mesh{cardMesh} // Get notified of mouse events and keyboard typing events. events := make(chan window.Event, 1) w.Notify(events, window.MouseEvents|window.KeyboardTypedEvents) for { // Handle each pending event. window.Poll(events, func(e window.Event) { switch ev := e.(type) { case mouse.ButtonEvent: // Toggle mouse grab when the user left clicks. if ev.Button == mouse.Left && ev.State == mouse.Down { props := w.Props() props.SetCursorGrabbed(!props.CursorGrabbed()) w.Request(props) } case keyboard.Typed: if ev.S == "s" || ev.S == "S" { log.Println("Writing texture to file...") // Download the texture image from the graphics hardware // and save it to disk. complete := make(chan image.Image, 1) // Begin the texture download. card.Textures[0].Download(card.Textures[0].Bounds, complete) // The download can occur in any goroutine! go func() { img := <-complete // Wait for download to complete. if img == nil { log.Println("Failed to download texture.") } else { // Save to png. f, err := os.Create("mandel.png") if err != nil { log.Fatal(err) } err = png.Encode(f, img) if err != nil { log.Fatal(err) } log.Println("Wrote texture to mandel.png") } }() } } }) // If the mandelbrot generator has a new image for us, update the // texture. select { case img := <-gen.Image: card.Textures[0].Loaded = false card.Textures[0].Source = img card.Textures[0].Bounds = img.Bounds() default: break } // Clear color and depth buffers. d.Clear(d.Bounds(), gfx.Color{1, 1, 1, 1}) d.ClearDepth(d.Bounds(), 1.0) // Draw the card to the screen. d.Draw(d.Bounds(), card, nil) // Render the whole frame. d.Render() } } func main() { window.Run(gfxLoop, nil) } ================================================ FILE: mvn-golang-examples/mvn-golang-example-azul3d-mandelbrot/src/go.mod ================================================ module github.com/mycodesmells/golang-examples/modules go 1.16 require github.com/azul3d/engine v0.0.0-20180624221640-25c8eab2d474 ================================================ FILE: mvn-golang-examples/mvn-golang-example-azul3d-mandelbrot/src/go.sum ================================================ azul3d.org/engine v0.0.0-20180624221640-25c8eab2d474 h1:HrLWoqa15YkXa5jtwSRy7mEmmO9ZOPEFe0uMNmH+iyI= azul3d.org/engine v0.0.0-20180624221640-25c8eab2d474/go.mod h1:3y1cwzJTKvXXop+EAg+AUVfNm3bfHf3djeX+l1UBuUE= azul3d.org/engine v0.0.0-20211024043305-793ea6c2839d h1:oLr8Nu7iEKm8OKfHNznBnBj8Z/SKBa20yl7JKqJn4W8= azul3d.org/engine v0.0.0-20211024043305-793ea6c2839d/go.mod h1:3y1cwzJTKvXXop+EAg+AUVfNm3bfHf3djeX+l1UBuUE= azul3d.org/examples v0.0.0-20170219024453-39fa3be83226 h1:xgmG3cM8LmSAfPiQhvOZp5JNqOgPr+Kb6wF5o1H5RHQ= azul3d.org/examples v0.0.0-20170219024453-39fa3be83226/go.mod h1:ggGp3QbtOy/bIBpAnqnmPMF3tl+rnGb3BlFA663bdnI= github.com/azul3d/engine v0.0.0-20180624221640-25c8eab2d474/go.mod h1:XJaK+eQA5QZRq/Y8jYtJnUGhqAfHxG3z2PgwiHvE2BA= github.com/go-gl/glfw v0.0.0-20210311203641-62640a716d48 h1:2Ql7UigDMdlF+Ii12kdox7RKw3J1+uGhXn9FyYbbd20= github.com/go-gl/glfw v0.0.0-20210311203641-62640a716d48/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw v0.0.0-20210410170116-ea3d685f79fb h1:yMlfD+jmoG8wwBVLaFwtcgNBY207iWsYwtNC9u+T2yk= github.com/go-gl/glfw v0.0.0-20210410170116-ea3d685f79fb/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw v0.0.0-20210715014612-ab6297867137 h1:2aB3ABFHtLwpLF3EIMAzv757PfpJ0o8auPE4WW9u5Cc= github.com/go-gl/glfw v0.0.0-20210715014612-ab6297867137/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw v0.0.0-20211024062804-40e447a793be h1:oYR4JFQpVEKyqRCJB8wsdDLUJ2i+MrEFSGiKQyueTtY= github.com/go-gl/glfw v0.0.0-20211024062804-40e447a793be/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw v0.0.0-20211204153444-caad923f49f4 h1:X5mrMrb9hBwzHfg17GAbXv5nMMr9o5mxPWAndv3DPZI= github.com/go-gl/glfw v0.0.0-20211204153444-caad923f49f4/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw v0.0.0-20211213063430-748e38ca8aec h1:um18JldLG6QwC9tj6mSfQnb+kor5aezfPPtq1GmHek0= github.com/go-gl/glfw v0.0.0-20211213063430-748e38ca8aec/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw v0.0.0-20220712193148-63cf1f4ef61f h1:z8fT51Xm9eZTbm7yNueifTyKssA6f4vQIhxvXlGG0ds= github.com/go-gl/glfw v0.0.0-20220712193148-63cf1f4ef61f/go.mod h1:wyvWpaEu9B/VQiV1jsPs7Mha9I7yto/HqIBw197ZAzk= github.com/go-gl/glfw v0.0.0-20221017161538-93cebf72946b h1:2hdUMUOJuLQkhaPAwoyOeSzoaBydYEkXkBEuqDuDBfg= github.com/go-gl/glfw v0.0.0-20221017161538-93cebf72946b/go.mod h1:wyvWpaEu9B/VQiV1jsPs7Mha9I7yto/HqIBw197ZAzk= github.com/go-gl/glfw v0.0.0-20240118000515-a250818d05e3 h1:NwSSG7RUXNhytGezuEEAwP64ffNjUxgKz/xEq2YJCFA= github.com/go-gl/glfw v0.0.0-20240118000515-a250818d05e3/go.mod h1:wyvWpaEu9B/VQiV1jsPs7Mha9I7yto/HqIBw197ZAzk= ================================================ FILE: mvn-golang-examples/mvn-golang-example-azul3d-mandelbrot/src/mandelbrot.go ================================================ // Copyright 2014 The Azul3D Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "image" "image/color" "math" ) // Calculates and returns a mandelbrot image. func Mandelbrot(w, h, maxIterations int, zoom, posX, posY float64) *image.RGBA { var ( img = image.NewRGBA(image.Rect(0, 0, w, h)) pr, pi float64 newRe, newIm, oldRe, oldIm float64 fw, fh = float64(w), float64(h) ) for y := 0; y < h; y++ { for x := 0; x < w; x++ { fx := float64(x) fy := float64(y) pr = 1.5*(fx-fw/2)/(0.5*zoom*fw) + posX pi = (fy-fh/2)/(0.5*zoom*fh) + posY newRe = 0 newIm = 0 oldRe = 0 oldIm = 0 var i int for i = 0; i < maxIterations; i++ { oldRe = newRe oldIm = newIm newRe = oldRe*oldRe - oldIm*oldIm + pr newIm = 2*oldRe*oldIm + pi if (newRe*newRe + newIm*newIm) > 4 { break } } if i == maxIterations { img.Set(x, y, color.Black) } else { z := math.Sqrt(newRe*newRe + newIm*newIm) brightness := uint8(256.0 * math.Log2(1.75+float64(i)-math.Log2(math.Log2(z))) / math.Log2(float64(maxIterations))) img.Set(x, y, color.RGBA{brightness, brightness, 255, 255}) } } } return img } ================================================ FILE: mvn-golang-examples/mvn-golang-example-clui/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-clui 1.0.0-SNAPSHOT mvn-golang CLUI example Example of usage CLUI library for GUI (https://github.com/VladimirMarkelov/clui). ${basedir}${file.separator}src ${basedir}${file.separator}bin ${basedir}${file.separator}res maven-resources-plugin 3.0.2 copy-resources validate copy-resources ${project.build.directory} ${basedir}${file.separator}res false com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} auto get-dependencies get github.com/VladimirMarkelov/clui ================================================ FILE: mvn-golang-examples/mvn-golang-example-clui/res/themes/acsii.theme ================================================ //----------------- Theme properties ----------------- title=ASCII author=Vladimir Markelov version=1.0 (2015-11-02) parent=default //----------------- Colors ----------------- // all are defaults ProgressBack = black bold ProgressText = white ProgressActiveBack = black bold ProgressActiveText = white //----------------- Objects ----------------- SingleBorder=-|++++ DoubleBorder==|++++ Edit=<>V ScrollBar=|O^V<> ViewButtons=^_X[] CheckBox=[] X? Radio=() * ProgressBar='| ' ================================================ FILE: mvn-golang-examples/mvn-golang-example-clui/res/themes/turbovision.theme ================================================ //----------------- Theme properties ----------------- title=TurboVision author=Vladimir Markelov version=1.0 (2016-01-04) parent=default //----------------- Colors ----------------- // View colors - internal area and border ViewBack = white ViewText = white bold // general colors Back = white Text = black DisabledText = white DisabledBack = black bold // editable & listbox-like controls (interactive ones) EditBack = blue EditText = yellow EditActiveBack = blue bold EditActiveText = yellow bold SelectionText = yellow bold SelectionBack = cyan bold // scroll control ScrollText = white bold ScrollBack = white ThumbText = white bold ThumbBack = white // window-like controls (checkbox, radiogroup...) ControlText = black ControlBack = cyan bold ControlActiveBack = cyan bold ControlActiveText = yellow bold ControlDisabledBack = cyan bold ControlDisabledText = black bold ControlShadow = black // progressbar control ProgressBack = blue ProgressText = yellow ProgressActiveBack = blue bold ProgressActiveText = yellow bold // button control ButtonBack=green bold ButtonText=black ButtonActiveBack=green bold ButtonActiveText=white bold ButtonShadowBack=black ButtonDisabledText=black bold ButtonDisabledBack=white // bar chart control BarChartBack=black BarChartText=white // spark chart SparkChartBack=black SparkChartText=white SparkChartBarBack=black SparkChartBarText=cyan SparkChartMaxBack=black SparkChartMaxText=cyan bold // table view TableText=white TableBack=black TableSelectedText=white TableSelectedBack=black bold TableActiveCellText=white bold TableActiveCellBack=black bold TableLineText=white TableHeaderText=white TableHeaderBack=black //----------------- Objects ----------------- SingleBorder=─│┌┐└┘ DoubleBorder=═║╔╗╚╝ Edit=←→V ScrollBar=░■▲▼◄► ViewButtons=^↓○[] CheckBox=[] X? Radio=() * ProgressBar=░▒ BarChart=█─│┌┐└┘┬┴├┤┼ SparkChart=█ TableView=─│┼▼▲ ================================================ FILE: mvn-golang-examples/mvn-golang-example-clui/src/main.go ================================================ package main import ( ui "github.com/VladimirMarkelov/clui" ) func main() { ui.InitLibrary() defer ui.DeinitLibrary() view := ui.AddWindow(0, 0, 10, 7, "Hello World!") view.SetPack(ui.Vertical) frmResize := ui.CreateFrame(view, 8, 6, ui.BorderNone, ui.Fixed) frmResize.SetTitle("FrameTop") frmResize.SetPack(ui.Horizontal) btn1 := ui.CreateButton(frmResize, 8, 5, "Button 1", 1) btn2 := ui.CreateButton(frmResize, 8, 5, "Button 2", 1) btn3 := ui.CreateButton(frmResize, 8, 5, "Button 3", 1) frmBtns := ui.CreateFrame(view, 8, 5, ui.BorderNone, ui.Fixed) frmBtns.SetPack(ui.Horizontal) frmBtns.SetTitle("FrameBottom") btnHide1 := ui.CreateButton(frmBtns, 8, 4, "Hide 1", 1) btnHide1.OnClick(func(ev ui.Event) { if btn1.Visible() { btnHide1.SetTitle("Show 1") ui.ActivateControl(view, btn1) btn1.SetVisible(false) } else { btnHide1.SetTitle("Hide 1") btn1.SetVisible(true) } }) btnHide2 := ui.CreateButton(frmBtns, 8, 4, "Hide 2", 1) btnHide2.OnClick(func(ev ui.Event) { if btn2.Visible() { btnHide2.SetTitle("Show 2") ui.ActivateControl(view, btn2) btn2.SetVisible(false) } else { btnHide2.SetTitle("Hide 2") btn2.SetVisible(true) } }) btnHide3 := ui.CreateButton(frmBtns, 8, 4, "Hide 3", 1) btnHide3.OnClick(func(ev ui.Event) { if btn3.Visible() { btnHide3.SetTitle("Show 3") ui.ActivateControl(view, btn3) btn3.SetVisible(false) } else { btnHide3.SetTitle("Hide 3") btn3.SetVisible(true) } }) btnQuit := ui.CreateButton(frmBtns, 8, 4, "Quit", 1) btnQuit.OnClick(func(ev ui.Event) { go ui.Stop() }) ui.MainLoop() } ================================================ FILE: mvn-golang-examples/mvn-golang-example-fyne/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-fyne mvn-golang TermUI example It builds a sample from https://github.com/fyne-io/fyne ${go.sdk.version} ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true true ================================================ FILE: mvn-golang-examples/mvn-golang-example-fyne/src/go.mod ================================================ module github.com/mycodesmells/golang-examples/fyne go 1.20 require fyne.io/fyne/v2 v2.5.1 require ( fyne.io/systray v1.11.0 // indirect github.com/BurntSushi/toml v1.4.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/fredbi/uri v1.1.0 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe // indirect github.com/fyne-io/glfw-js v0.0.0-20240101223322-6e1efdc71b7a // indirect github.com/fyne-io/image v0.0.0-20220602074514-4956b0afb3d2 // indirect github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 // indirect github.com/go-gl/glfw/v3.3/glfw v0.0.0-20240506104042-037f3cc74f2a // indirect github.com/go-text/render v0.1.1-0.20240418202334-dd62631dae9b // indirect github.com/go-text/typesetting v0.1.0 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/gopherjs/gopherjs v1.17.2 // indirect github.com/jeandeaual/go-locale v0.0.0-20240223122105-ce5225dcaa49 // indirect github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e // indirect github.com/nicksnyder/go-i18n/v2 v2.4.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rymdport/portal v0.2.6 // indirect github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c // indirect github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef // indirect github.com/stretchr/testify v1.8.4 // indirect github.com/yuin/goldmark v1.7.1 // indirect golang.org/x/image v0.18.0 // indirect golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/sys v0.20.0 // indirect golang.org/x/text v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) ================================================ FILE: mvn-golang-examples/mvn-golang-example-fyne/src/go.sum ================================================ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= fyne.io/fyne/v2 v2.5.1 h1:jd2mhQz0ViosZjhgR5l2bdCbc5HFqkYnTzEXX8UOC7I= fyne.io/fyne/v2 v2.5.1/go.mod h1:NdxEG8L7EVWo06/cYbXW11uA0X7UG8Q8j5CLebvTZi8= fyne.io/systray v1.11.0 h1:D9HISlxSkx+jHSniMBR6fCFOUjk1x/OOOJLa9lJYAKg= fyne.io/systray v1.11.0/go.mod h1:RVwqP9nYMo7h5zViCBHri2FgjXF7H2cub7MAq4NSoLs= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fredbi/uri v1.1.0 h1:OqLpTXtyRg9ABReqvDGdJPqZUxs8cyBDOMXBbskCaB8= github.com/fredbi/uri v1.1.0/go.mod h1:aYTUoAXBOq7BLfVJ8GnKmfcuURosB1xyHDIfWeC/iW4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe h1:A/wiwvQ0CAjPkuJytaD+SsXkPU0asQ+guQEIg1BJGX4= github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe/go.mod h1:d4clgH0/GrRwWjRzJJQXxT/h1TyuNSfF/X64zb/3Ggg= github.com/fyne-io/glfw-js v0.0.0-20240101223322-6e1efdc71b7a h1:ybgRdYvAHTn93HW79bLiBiJwVL4jVeyGQRZMgImoeWs= github.com/fyne-io/glfw-js v0.0.0-20240101223322-6e1efdc71b7a/go.mod h1:gsGA2dotD4v0SR6PmPCYvS9JuOeMwAtmfvDE7mbYXMY= github.com/fyne-io/image v0.0.0-20220602074514-4956b0afb3d2 h1:hnLq+55b7Zh7/2IRzWCpiTcAvjv/P8ERF+N7+xXbZhk= github.com/fyne-io/image v0.0.0-20220602074514-4956b0afb3d2/go.mod h1:eO7W361vmlPOrykIg+Rsh1SZ3tQBaOsfzZhsIOb/Lm0= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 h1:zDw5v7qm4yH7N8C8uWd+8Ii9rROdgWxQuGoJ9WDXxfk= github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6/go.mod h1:9YTyiznxEY1fVinfM7RvRcjRHbw2xLBJ3AAGIT0I4Nw= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20240506104042-037f3cc74f2a h1:vxnBhFDDT+xzxf1jTJKMKZw3H0swfWk9RpWbBbDK5+0= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20240506104042-037f3cc74f2a/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-text/render v0.1.1-0.20240418202334-dd62631dae9b h1:daoFn+Aw8EIQZO9kYWwHL01FqwwpCl2nTeVEYbsgRHk= github.com/go-text/render v0.1.1-0.20240418202334-dd62631dae9b/go.mod h1:jqEuNMenrmj6QRnkdpeaP0oKGFLDNhDkVKwGjsWWYU4= github.com/go-text/typesetting v0.1.0 h1:vioSaLPYcHwPEPLT7gsjCGDCoYSbljxoHJzMnKwVvHw= github.com/go-text/typesetting v0.1.0/go.mod h1:d22AnmeKq/on0HNv73UFriMKc4Ez6EqZAofLhAzpSzI= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20211219123610-ec9572f70e60/go.mod h1:cz9oNYuRUWGdHmLF2IodMLkAhcPtXeULvcBNagUrxTI= github.com/gopherjs/gopherjs v1.17.2 h1:fQnZVsXk8uxXIStYb0N4bGk7jeyTalG/wsZjQ25dO0g= github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k= github.com/goxjs/gl v0.0.0-20210104184919-e3fafc6f8f2a/go.mod h1:dy/f2gjY09hwVfIyATps4G2ai7/hLwLkc5TrPqONuXY= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jeandeaual/go-locale v0.0.0-20240223122105-ce5225dcaa49 h1:Po+wkNdMmN+Zj1tDsJQy7mJlPlwGNQd9JZoPjObagf8= github.com/jeandeaual/go-locale v0.0.0-20240223122105-ce5225dcaa49/go.mod h1:YiutDnxPRLk5DLUFj6Rw4pRBBURZY07GFr54NdV9mQg= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e h1:LvL4XsI70QxOGHed6yhQtAU34Kx3Qq2wwBzGFKY8zKk= github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e/go.mod h1:kLgvv7o6UM+0QSf0QjAse3wReFDsb9qbZJdfexWlrQw= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= github.com/neelance/sourcemap v0.0.0-20200213170602-2833bce08e4c/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/nicksnyder/go-i18n/v2 v2.4.0 h1:3IcvPOAvnCKwNm0TB0dLDTuawWEj+ax/RERNC+diLMM= github.com/nicksnyder/go-i18n/v2 v2.4.0/go.mod h1:nxYSZE9M0bf3Y70gPQjN9ha7XNHX7gMc814+6wVyEI4= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/rymdport/portal v0.2.6 h1:HWmU3gORu7vWcpr7VSwUS2Xx1HtJXVcUuTqEZcMEsIg= github.com/rymdport/portal v0.2.6/go.mod h1:kFF4jslnJ8pD5uCi17brj/ODlfIidOxlgUDTO5ncnC4= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shurcooL/go v0.0.0-20200502201357-93f07166e636/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c h1:km8GpoQut05eY3GiYWEedbTT0qnSxrCjsVbb7yKY1KE= github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c/go.mod h1:cNQ3dwVJtS5Hmnjxy6AgTPd0Inb3pW05ftPSX7NZO7Q= github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef h1:Ch6Q+AZUxDBCVqdkI8FSpFyZDtCVBc2VmejdNrm5rRQ= github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef/go.mod h1:nXTWP6+gD5+LUJ8krVhhoeHjvHTutPxMYl5SvkcnJNE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.7.1 h1:3bajkSilaCbjdKVsKdZjZCLBNPL9pYzrCakKaf4U49U= github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ= golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mobile v0.0.0-20211207041440-4e6c2922fdee/go.mod h1:pe2sM7Uk+2Su1y7u/6Z8KJ24D7lepUjFZbhFOrmDfuQ= golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a h1:sYbmY3FwUWCBTodZL1S3JUuOvaW6kM2o+clDzzDNBWg= golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a/go.mod h1:Ede7gF0KGoHlj822RtphAHK1jLdrcuRBZg0sF1Q+SPc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.8-0.20211022200916-316ba0b74098/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= ================================================ FILE: mvn-golang-examples/mvn-golang-example-fyne/src/hello.go ================================================ package main import ( "fyne.io/fyne/v2/app" "fyne.io/fyne/v2/container" "fyne.io/fyne/v2/widget" ) func main() { a := app.New() w := a.NewWindow("Hello") hello := widget.NewLabel("Hello Fyne!") w.SetContent(container.NewVBox( hello, widget.NewButton("Hi!", func() { hello.SetText("Welcome :)") }), )) w.ShowAndRun() } ================================================ FILE: mvn-golang-examples/mvn-golang-example-genbindata/data/la_espero.txt ================================================ En la mondon venis nova sento, Tra la mondo iras forta voko; Per flugiloj de facila vento Nun de loko flugu ĝi al loko. Ne al glavo sangon soifanta Ĝi la homan tiras familion: Al la mond' eterne militanta Ĝi promesas sanktan harmonion. Sub la sankta signo de l' espero Kolektiĝas pacaj batalantoj, Kaj rapide kreskas la afero Per laboro de la esperantoj. Forte staras muroj de miljaroj Inter la popoloj dividitaj; Sed dissaltos la obstinaj baroj, Per la sankta amo disbatitaj. Sur neŭtrala lingva fundamento, Komprenante unu la alian, La popoloj faros en konsento Unu grandan rondon familian. Nia diligenta kolegaro En laboro paca ne laciĝos, Ĝis la bela sonĝo de l' homaro Por eterna ben' efektiviĝos. ================================================ FILE: mvn-golang-examples/mvn-golang-example-genbindata/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-genbindata 1.0.0-SNAPSHOT mvn-golang Example of GEN + BinData Example of GoBinData utility call from 'gen' command. ${basedir}${file.separator}src ${basedir}${file.separator}bin ${basedir}${file.separator}data com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} ${basedir}${file.separator}bin auto default-get get -u true github.com/jteeuwen/go-bindata/... default-build run main.go ================================================ FILE: mvn-golang-examples/mvn-golang-example-genbindata/src/main.go ================================================ package main import ( "example/bindata" "fmt" "os" ) //go:generate go-bindata -prefix "../data/" -pkg bindata -o ../bin/src/example/bindata/binasset.go ../data/... func main() { data, err := bindata.Asset("la_espero.txt") if err != nil { fmt.Printf("Can't find needed asset") os.Exit(1) } fmt.Printf("\n La Espero\n==================\n%v", string(data)) } ================================================ FILE: mvn-golang-examples/mvn-golang-example-gocui/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-gocui mvn-golang GOCUI example Example of GOCUI https://github.com/jroimartin/gocui ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} auto default-get github.com/jroimartin/gocui ================================================ FILE: mvn-golang-examples/mvn-golang-example-gocui/src/gocui.go ================================================ package main import ( "fmt" "log" "github.com/jroimartin/gocui" ) func main() { g, err := gocui.NewGui(gocui.OutputNormal) if err != nil { log.Panicln(err) } defer g.Close() g.SetManagerFunc(layout) if err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit); err != nil { log.Panicln(err) } if err := g.MainLoop(); err != nil && err != gocui.ErrQuit { log.Panicln(err) } } func layout(g *gocui.Gui) error { maxX, maxY := g.Size() if v, err := g.SetView("hello", maxX/2-7, maxY/2, maxX/2+7, maxY/2+2); err != nil { if err != gocui.ErrUnknownView { return err } fmt.Fprintln(v, "\x1b[0;31mHello world") } return nil } func quit(g *gocui.Gui, v *gocui.View) error { return gocui.ErrQuit } ================================================ FILE: mvn-golang-examples/mvn-golang-example-goexample/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-goexample 1.0.0-SNAPSHOT mvn-golang GoExample Example of minimalistic usage of mvn-golang-wrapper to build a 'Hello World' example. ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true auto ${go.sdk.version} ================================================ FILE: mvn-golang-examples/mvn-golang-example-goexample/src/golang-book/chapter11/math/math.go ================================================ package math func Average(xs []float64) float64 { total := float64(0) for _, x := range xs { total += x } return total / float64(len(xs)) } ================================================ FILE: mvn-golang-examples/mvn-golang-example-goexample/src/golang-book/chapter11/math/math_test.go ================================================ package math import "testing" func TestAverage(t *testing.T) { var v float64 v = Average([]float64{1, 2}) if v != 1.5 { t.Error("Expected 1.5, got ", v) } } ================================================ FILE: mvn-golang-examples/mvn-golang-example-goexample/src/main.go ================================================ package main import "fmt" import "golang-book/chapter11/math" func main() { xs := []float64{1, 2, 3, 4} avg := math.Average(xs) fmt.Println(avg) } ================================================ FILE: mvn-golang-examples/mvn-golang-example-goterm/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-goterm mvn-golang GoTerm example Example of GoTerm usage with GoLang https://github.com/buger/goterm ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} auto default-get -u true github.com/buger/goterm ================================================ FILE: mvn-golang-examples/mvn-golang-example-goterm/src/time.go ================================================ package main import ( tm "github.com/buger/goterm" "math" ) func main() { tm.Clear() tm.MoveCursor(0, 0) chart := tm.NewLineChart(100, 20) data := new(tm.DataTable) data.AddColumn("Time") data.AddColumn("Sin(x)") data.AddColumn("Cos(x+1)") for i := 0.1; i < 10; i += 0.1 { data.AddRow(i, math.Sin(i), math.Cos(i+1)) } tm.Println(chart.Draw(data)) tm.Flush() } ================================================ FILE: mvn-golang-examples/mvn-golang-example-gui/dependencies.txt ================================================ package:github.com/andlabs/ui,revision:867a9e5a498d85e2722730ed88c5f00560c7c354 ================================================ FILE: mvn-golang-examples/mvn-golang-example-gui/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-gui 1.0.0-SNAPSHOT mvn-golang GUI example Example of minimalistic GUI application. ${basedir}${file.separator}dependencies.txt ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} LINUX: if build complains about GTK 3.0 then use sudo apt-get install libgtk-3-dev auto ================================================ FILE: mvn-golang-examples/mvn-golang-example-gui/src/main.go ================================================ package main import ( "github.com/andlabs/ui" ) func main() { err := ui.Main(func() { name := ui.NewEntry() button := ui.NewButton("Greet") greeting := ui.NewLabel("") box := ui.NewVerticalBox() box.Append(ui.NewLabel("Enter your name:"), false) box.Append(name, false) box.Append(button, false) box.Append(greeting, false) window := ui.NewWindow("Hello", 200, 100, false) window.SetChild(box) button.OnClicked(func(*ui.Button) { greeting.SetText("Hello, " + name.Text() + "!") }) window.OnClosing(func(*ui.Window) bool { ui.Quit() return true }) window.Show() }) if err != nil { panic(err) } } ================================================ FILE: mvn-golang-examples/mvn-golang-example-gui-gwt/backend/pom.xml ================================================ 4.0.0 com.igormaznitsa.go-gwt mvn-golang-example-gui-gwt 1.0.0-SNAPSHOT backend 1.0.0-SNAPSHOT mvn-golang Backend part of the GoLang+GWT example, it implements the server side. ${project.groupId} frontend ${project.version} provided under-windows windows .exe ${project.artifactId}-${project.version}${final.extension} ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} auto ${basedir}${file.separator}bin default-get get -u true github.com/jteeuwen/go-bindata/... github.com/skratchdot/open-golang/open ================================================ FILE: mvn-golang-examples/mvn-golang-example-gui-gwt/backend/src/main.go ================================================ package main import ( "bytes" "encoding/json" "front/bindata" "github.com/skratchdot/open-golang/open" "io" "log" "mime" "net" "net/http" "os" pathop "path" "strconv" "time" ) //go:generate go-bindata -prefix "../../frontend/target/frontend.out" -pkg bindata -o ../bin/src/front/bindata/binasset.go ../../frontend/target/frontend.out/... var watchdog_chn = make(chan int) type data_struct struct { Data string } type push_event struct { Time int64 } func makeTimestamp() int64 { return time.Now().UnixNano() / (int64(time.Millisecond) / int64(time.Nanosecond)) } var eventmap = map[string](func(data_struct) data_struct){ "buttons/send": eventButtonSend, } func eventButtonSend(data data_struct) data_struct { data.Data = data.Data + "! Hello from the Go side!" return data } func push_handler(rw http.ResponseWriter, req *http.Request) { watchdog_chn <- 0 rw.Header().Set("Content-Type", "application/json") rw.Header().Set("Cache-Control", "no-cache") var data push_event data.Time = makeTimestamp() js, err := json.Marshal(data) if err != nil { log.Panic(err) } rw.Write(js) } func watchdog() { for { select { case <-watchdog_chn: case <-time.After(5 * time.Second): log.Print("Looks like that UI part has been closed") os.Exit(0) } } } func static_handler(rw http.ResponseWriter, req *http.Request) { if req.Method == http.MethodGet { var path string = req.URL.Path if path == "" { path = "index.html" } if path == "__mailbox__" { push_handler(rw, req) } else { if bs, err := bindata.Asset(path); err != nil { log.Printf("Can't find resource : %s", path) rw.WriteHeader(http.StatusNotFound) } else { mime := mime.TypeByExtension(pathop.Ext(path)) var reader = bytes.NewBuffer(bs) if mime == "" { mime = http.DetectContentType(bs) } log.Printf("Resource '%s' mime=%s", path, mime) rw.Header().Set("Content-Type", mime) rw.Header().Set("Cache-Control", "no-cache") io.Copy(rw, reader) } } } else if req.Method == http.MethodPost { path := req.URL.Path log.Printf("Incoming event : %s", path) eventfunc := eventmap[path] if eventfunc == nil { log.Panic("Can't find event processor for " + path) } decoder := json.NewDecoder(req.Body) var t data_struct err := decoder.Decode(&t) if err != nil { http.Error(rw, err.Error(), http.StatusInternalServerError) log.Print(err) } else { t = eventfunc(t) js, error := json.Marshal(t) if error != nil { http.Error(rw, error.Error(), http.StatusInternalServerError) } else { rw.Header().Set("Content-Type", "application/json") rw.Header().Set("Cache-Control", "no-cache") rw.Write(js) } } } } func findFreePort() (int, error) { addr, err := net.ResolveTCPAddr("tcp", "127.0.0.1:0") if err != nil { return 0, err } l, err := net.ListenTCP("tcp", addr) if err != nil { return 0, err } defer l.Close() return l.Addr().(*net.TCPAddr).Port, nil } func main() { port, err := findFreePort() if err != nil { log.Fatal(err) } log.Printf("Application server address 127.0.0.1:%d", port) http.Handle("/", http.StripPrefix("/", http.HandlerFunc(static_handler))) listenStartBrowserAndServe("127.0.0.1:" + strconv.Itoa(port)) } type tcpKeepAliveListener struct { *net.TCPListener } func listenStartBrowserAndServe(addr string) error { server := &http.Server{Addr: addr, Handler: nil} ln, err := net.Listen("tcp", addr) if err != nil { return err } err = open.Run("http://" + addr + "/index.html") if err != nil { return err } go watchdog() return server.Serve(tcpKeepAliveListener{ln.(*net.TCPListener)}) } ================================================ FILE: mvn-golang-examples/mvn-golang-example-gui-gwt/frontend/pom.xml ================================================ 4.0.0 com.igormaznitsa.go-gwt mvn-golang-example-gui-gwt 1.0.0-SNAPSHOT frontend jar Frontend part of the GoLang+GWT example, it implements web based GUI. org.gwtproject gwt-user provided org.gwtproject gwt-dev provided junit junit 4.13.2 test frontend.out ${project.build.directory}/${project.build.finalName}/WEB-INF/classes org.apache.maven.plugins maven-compiler-plugin 3.7.0 1.8 1.8 org.apache.maven.plugins maven-war-plugin 3.2.0 war-exploded package exploded org.apache.maven.plugins maven-clean-plugin delete-webinf-in-result package clean true ${project.build.directory}/${project.build.finalName}/WEB-INF ${project.build.directory}/${project.build.finalName}/META-INF false org.codehaus.mojo gwt-maven-plugin 2.8.1 compile index.html com.igormaznitsa.gwtfrontend ================================================ FILE: mvn-golang-examples/mvn-golang-example-gui-gwt/frontend/src/main/java/com/igormaznitsa/client/BackendService.java ================================================ /* * Copyright 2018 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.client; import com.google.gwt.http.client.Request; import com.google.gwt.http.client.RequestBuilder; import com.google.gwt.http.client.RequestCallback; import com.google.gwt.http.client.RequestException; import com.google.gwt.http.client.Response; import com.google.gwt.http.client.UrlBuilder; import com.google.gwt.json.client.JSONObject; import com.google.gwt.json.client.JSONParser; import com.google.gwt.json.client.JSONString; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Window; public class BackendService { public interface PushListener { /** * Notificaton for push event * @param event event data as JSON object * @return true if push event should continue processing, false if push event shold be stopped */ boolean onPushEvent(JSONObject event); /** * Notification about error in push event mechanism * @param thr error object * @return true if push event mechanism should continue its work, false if it should be stopped */ boolean onPushSystemError(Throwable thr); } public interface Callback { void onResponseReceived(String eventId, JSONObject wholeJsonResponse, String dataFeldValue); void onError(String eventId, Throwable exception); } private final Timer pushCheckTimer; private final PushListener pushListener; public BackendService(final PushListener pushListener) { this.pushListener = pushListener; if (this.pushListener != null) { this.pushCheckTimer = new Timer() { @Override public void run() { checkPushEvents(); } }; this.pushCheckTimer.scheduleRepeating(1000); } else { this.pushCheckTimer = null; } } private void checkPushEvents() { try { final RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, makeUrlForResource("__mailbox__")); rb.setHeader("Accept", "application/json"); rb.sendRequest("", new RequestCallback() { @Override public void onResponseReceived(Request request, Response response) { switch (response.getStatusCode()) { case 204: { // there are no push events }break; case 200: { final JSONObject jobj = (JSONObject) JSONParser.parseStrict(response.getText()); if (!pushListener.onPushEvent(jobj)){ pushCheckTimer.cancel(); } } break; default: { if (!pushListener.onPushSystemError(new Throwable("Not OK response : " + response.getStatusCode()))){ pushCheckTimer.cancel(); } } break; } } @Override public void onError(Request request, Throwable exception) { if (!pushListener.onPushSystemError(exception)){ pushCheckTimer.cancel(); } } }); } catch (RequestException ex) { if (!pushListener.onPushSystemError(ex)){ pushCheckTimer.cancel(); } } } public void doDataRequest(final String eventId, final String dataFieldValue, final Callback reqCallback) { try { final RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, makeUrlForResource(eventId)); rb.setHeader("Content-Type", "application/json; charset=utf-8"); rb.setHeader("Accept", "application/json"); final JSONObject jsonObj = new JSONObject(); jsonObj.put("Data", new JSONString(dataFieldValue)); rb.sendRequest(jsonObj.toString(), new RequestCallback() { @Override public void onResponseReceived(Request request, Response response) { switch (response.getStatusCode()) { case 0: { reqCallback.onError(eventId, new Throwable("Server is unavaliable")); } break; case 200: { final JSONObject jobj = (JSONObject) JSONParser.parseStrict(response.getText()); reqCallback.onResponseReceived(eventId, jobj, ((JSONString) jobj.get("Data")).stringValue()); } break; default: { reqCallback.onError(eventId, new Throwable("Unexpected response code : " + response.getStatusCode())); } break; } } @Override public void onError(Request request, Throwable exception) { reqCallback.onError(eventId, exception); } }); } catch (RequestException e) { reqCallback.onError(eventId, e); } } private static String makeUrlForResource(final String path) { final UrlBuilder urlBuilder = new UrlBuilder(); urlBuilder.setHost(Window.Location.getHost()); urlBuilder.setPath(path); final String port = Window.Location.getPort(); if (!port.isEmpty()) { urlBuilder.setPort(Integer.parseInt(port)); } return urlBuilder.buildString(); } } ================================================ FILE: mvn-golang-examples/mvn-golang-example-gui-gwt/frontend/src/main/java/com/igormaznitsa/client/FrontendMain.java ================================================ package com.igormaznitsa.client; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.shared.GWT; import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.json.client.JSONObject; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.TextBox; import java.util.Date; import java.util.logging.Logger; public class FrontendMain implements EntryPoint, BackendService.PushListener { private static final Logger LOGGER = Logger.getLogger("FrontendMain"); private static final DateTimeFormat timeFormatter = DateTimeFormat.getFormat("HH:mm:ss"); private final Messages messages = GWT.create(Messages.class); private Label errorLabel; private Label messageLabel; private Label timerLabel; private Button sendButton; private BackendService backend; @Override public void onModuleLoad() { sendButton = new Button(messages.sendButton()); final TextBox nameField = new TextBox(); nameField.setText(messages.nameField()); errorLabel = new Label(); messageLabel = new Label(); timerLabel = new Label("--:--:--"); // We can add style names to widgets sendButton.addStyleName("sendButton"); // Add components into named zones of page // Use RootPanel.get() to get the entire body element RootPanel.get("nameFieldContainer").add(nameField); RootPanel.get("sendButtonContainer").add(sendButton); RootPanel.get("messageLabelContainer").add(this.messageLabel); RootPanel.get("errorLabelContainer").add(this.errorLabel); RootPanel.get("timerZone").add(this.timerLabel); // Focus the cursor on the name field when the app loads nameField.setFocus(true); nameField.selectAll(); sendButton.addClickHandler(event -> { sendButton.setEnabled(false); errorLabel.setText(""); messageLabel.setText(""); backend.doDataRequest("buttons/send", nameField.getText(), new BackendService.Callback(){ @Override public void onResponseReceived(String eventId, JSONObject wholeJsonResponse, String dataFeldValue) { messageLabel.setText(dataFeldValue); sendButton.setEnabled(true); } @Override public void onError(String eventId, Throwable exception) { LOGGER.severe("Error '"+eventId+"', "+exception); errorLabel.setText(exception.getMessage()); sendButton.setEnabled(true); } }); }); nameField.addKeyDownHandler(event -> { // if enter then send data if (event.getNativeKeyCode() == 13) { sendButton.click(); } }); this.backend = new BackendService(this); } @Override public boolean onPushEvent(final JSONObject event) { final long time = (long)event.get("Time").isNumber().doubleValue(); this.timerLabel.setText(timeFormatter.format(new Date(time))); return true; } @Override public boolean onPushSystemError(final Throwable thr) { this.timerLabel.setText("Can't get time from server"); Window.alert("Detected error in push event system : "+thr.getMessage()); return false; } } ================================================ FILE: mvn-golang-examples/mvn-golang-example-gui-gwt/frontend/src/main/java/com/igormaznitsa/client/Messages.java ================================================ package com.igormaznitsa.client; import com.google.gwt.i18n.client.LocalizableResource.Generate; @Generate(format = "com.google.gwt.i18n.server.PropertyCatalogFactory") public interface Messages extends com.google.gwt.i18n.client.Messages { @DefaultMessage("Enter your name") String nameField(); @DefaultMessage("Send") String sendButton(); } ================================================ FILE: mvn-golang-examples/mvn-golang-example-gui-gwt/frontend/src/main/resources/com/igormaznitsa/client/Messages_fr.properties ================================================ sendButton = Envoyer nameField = Entrez votre nom ================================================ FILE: mvn-golang-examples/mvn-golang-example-gui-gwt/frontend/src/main/resources/com/igormaznitsa/gwtfrontend.gwt.xml ================================================ ================================================ FILE: mvn-golang-examples/mvn-golang-example-gui-gwt/frontend/src/main/webapp/WEB-INF/web.xml ================================================ index.html ================================================ FILE: mvn-golang-examples/mvn-golang-example-gui-gwt/frontend/src/main/webapp/index.html ================================================ GoLang+GWT Example
GoLang+GWT Example

Please enter your name:
Time on the server side:
================================================ FILE: mvn-golang-examples/mvn-golang-example-gui-gwt/frontend/src/main/webapp/main.css ================================================ body { margin-top: 5% !important; margin-bottom: 5% !important; margin-left: 10% !important; margin-right: 10% !important; } .mainTitle { text-align: left; margin-left: 40px; font-size: 48pt; font-weight: bold; color: darkgray; } .subTitle { text-align: center; margin-left: 40px; font-size: 20pt; font-weight: bold; color: darkgray; } .sendButton { display: block; font-size: 16pt; } .bottomRecord { text-align: right; } .bottomRecord a { color: cornflowerblue !important; text-decoration: none !important; } /** Most GWT widgets already have a style name defined */ .gwt-DialogBox { width: 400px; } .dialogVPanel { margin: 5px; } .serverResponseLabelError { color: red; } ================================================ FILE: mvn-golang-examples/mvn-golang-example-gui-gwt/frontend/src/test/resources/com/igormaznitsa/gotestJUnit.gwt.xml ================================================ ================================================ FILE: mvn-golang-examples/mvn-golang-example-gui-gwt/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT com.igormaznitsa.go-gwt mvn-golang-example-gui-gwt 1.0.0-SNAPSHOT pom UTF-8 ${main-project-version} 1.8 1.8 2.11.0 frontend backend org.gwtproject gwt ${gwt.version} pom import ================================================ FILE: mvn-golang-examples/mvn-golang-example-helloworld/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-helloworld 1.0.0-SNAPSHOT mvn-golang Hello World example Example of minimalistic usage of mvn-golang-wrapper to build a 'Hello World' example. ${basedir}${file.separator}src ${basedir}${file.separator}bin exec-maven-plugin org.codehaus.mojo 1.6.0 initialize exec bash -c echo build.date.stamp=`date +%Y%m%d.%H%M%S` ${project.build.directory}/timestamp.properties org.codehaus.mojo properties-maven-plugin 1.0.0 initialize read-project-properties ${project.build.directory}/timestamp.properties com.igormaznitsa mvn-golang-wrapper ${main-project-version} true auto ${go.sdk.version} default-build -X "main.Buildstamp=${build.date.stamp}" -X "main.svnRevision=22543" default-test none go-vet test-compile vet true vet.out.log vet.err.log org.apache.maven.plugins maven-enforcer-plugin 3.0.0-M3 check-vet-out-log-size test-compile enforce 0 0 ${project.build.directory}${file.separator}reports${file.separator}vet.out.log true check-vet-err-log-size test-compile enforce 100 200 ${project.build.directory}${file.separator}reports${file.separator}vet.err.log true ================================================ FILE: mvn-golang-examples/mvn-golang-example-helloworld/src/main.go ================================================ package main import ( "fmt" "sync" "sync/atomic" ) var Buildstamp string var svnRevision string func FunctionForVetReport() { var a int32 = 0 var wg sync.WaitGroup for i := 0; i < 500; i++ { wg.Add(1) go func() { a = atomic.AddInt32(&a, 1) wg.Done() }() } wg.Wait() } func main() { fmt.Printf(Buildstamp + " " + svnRevision + "\n") } ================================================ FILE: mvn-golang-examples/mvn-golang-example-helloworld-gomod/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-helloworld-gomod 1.0.0-SNAPSHOT mvn-golang Hello World with go.mod example Example of go.mod use to get needed dependencies. https://www.mycodesmells.com/post/go-modules-example ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} true go-list list {{.String}} true do-run run main.go -name somename ================================================ FILE: mvn-golang-examples/mvn-golang-example-helloworld-gomod/src/go.mod ================================================ module github.com/mycodesmells/golang-examples/modules require github.com/pkg/errors v0.9.1 ================================================ FILE: mvn-golang-examples/mvn-golang-example-helloworld-gomod/src/go.sum ================================================ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= ================================================ FILE: mvn-golang-examples/mvn-golang-example-helloworld-gomod/src/main.go ================================================ package main import ( "flag" "fmt" "github.com/pkg/errors" ) // parts of https://www.mycodesmells.com/post/go-modules-example in use func main() { name := flag.String("name", "", "name") flag.Parse() if err := greet(*name); err != nil { fmt.Printf("Failed to greet you: %v", err) } } func greet(name string) error { if name == "" { return errors.New("no name provided") } fmt.Printf("Hello %s! I'm not in the $GOPATH!\n", name) return nil } ================================================ FILE: mvn-golang-examples/mvn-golang-example-helloworld-multisrc/lib1/src/pack1/src1some.go ================================================ package pack1 func Pack1() string { return "Pack1" } ================================================ FILE: mvn-golang-examples/mvn-golang-example-helloworld-multisrc/lib2/src/pack2/src2some.go ================================================ package pack2 import ( "pack1" ) func Pack2() string { return "Pack2-" + pack1.Pack1() } ================================================ FILE: mvn-golang-examples/mvn-golang-example-helloworld-multisrc/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-helloworld-multisrc 1.0.0-SNAPSHOT mvn-golang Hello World multi-src example Example of minimalistic usage of mvn-golang-wrapper to build a 'Hello World' example with multiple source folders. ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} auto ${basedir}${file.separator}lib1 ${basedir}${file.separator}lib2 run main.go ================================================ FILE: mvn-golang-examples/mvn-golang-example-helloworld-multisrc/src/main.go ================================================ package main import ( "fmt" "pack2" ) func main() { fmt.Printf("Hello, " + pack2.Pack2() + "\n") } ================================================ FILE: mvn-golang-examples/mvn-golang-example-logrus/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-logrus mvn-golang Go Logrus use example Example of use Logrus library from https://banzaicloud.com/blog/runtime-logging/ ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} auto default-get github.com/sirupsen/logrus ================================================ FILE: mvn-golang-examples/mvn-golang-example-logrus/src/gologrus.go ================================================ package main import ( log "github.com/sirupsen/logrus" "os" ) func init() { // Log as JSON instead of the default ASCII formatter. log.SetFormatter(&log.JSONFormatter{}) // Output to stdout instead of the default stderr // Can be any io.Writer, see below for File example log.SetOutput(os.Stdout) // Only log the info severity or above. log.SetLevel(log.InfoLevel) } func foo() { log.WithFields(log.Fields{ "prefix": "sensor", "temperature": -4, }).Info("Temperature changes") } func main() { foo() } ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-module-mix/mvn-go-test-mix-app/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-example-maven-module-mix 1.0.0-SNAPSHOT mvn-go-test-mix-app mvn-golang com.igormaznitsa mvn-go-test-mix-terminal 1.0.0-SNAPSHOT mvn-golang com.igormaznitsa mvn-go-test-mix-proxy 1.0.0-SNAPSHOT mvn-golang ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} auto print-module-graph validate mod graph do-vet vet do-run run main.go ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-module-mix/mvn-go-test-mix-app/src/go.mod ================================================ module main require ( com.igormaznitsa/testmixproxy v1.0.0 com.igormaznitsa/testmixterminal v1.0.0 ) ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-module-mix/mvn-go-test-mix-app/src/go.sum ================================================ github.com/cjbassi/drawille-go v0.0.0-20190126131713-27dc511fe6fd h1:XtfPmj9tQRilnrEmI1HjQhxXWRhEM+m8CACtaMJE/kM= github.com/cjbassi/drawille-go v0.0.0-20190126131713-27dc511fe6fd/go.mod h1:vjcQJUZJYD3MeVGhtZXSMnCHfUNZxsyYzJt90eCYxK4= github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e h1:p1yVGRW3nmb85p1Sh1ZJSDm4A4iKLS5QNbvUHMgGu/M= github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/gizak/termui/v3 v3.0.0 h1:NYTUG6ig/sJK05O5FyhWemwlVPO8ilNpvS/PgRtrKAE= github.com/gizak/termui/v3 v3.0.0/go.mod h1:uinu2dMdtMI+FTIdEFUJQT5y+KShnhQRshvPblXq3lY= github.com/mattn/go-runewidth v0.0.2 h1:UnlwIPBGaTZfPQ6T1IGzPI0EkYAQmT9fAEJ/poFC63o= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d h1:x3S6kxmy49zXVVyhcnrFqxvNVCBPb2KZ9hV2RBdS840= github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ= golang.org/x/arch v0.0.0-20181203225421-5a4828bb7045/go.mod h1:cYlCBUl1MsqxdiKgmc4uh7TxZfWSFLOGSRR090WDxt8= ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-module-mix/mvn-go-test-mix-app/src/main.go ================================================ package main import ( "com.igormaznitsa/testmixproxy" "com.igormaznitsa/testmixterminal" "fmt" "os" ) func main() { if len(os.Args) > 1 { arg := os.Args[1] if arg == "proxy" { fmt.Println("Selected proxy") testmixproxy.StartProxy() } else if arg == "terminal" { fmt.Println("Selected terminal") testmixterminal.StartTerminal() } else { fmt.Println("Hello world!") } } else { fmt.Println("Select 'proxy' or 'teminal'") } } ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-module-mix/mvn-go-test-mix-proxy/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-example-maven-module-mix 1.0.0-SNAPSHOT mvn-go-test-mix-proxy mvn-golang ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} auto ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-module-mix/mvn-go-test-mix-proxy/src/com.igormaznitsa/testmixproxy/Proxy.go ================================================ package testmixproxy import ( "flag" "github.com/elazarl/goproxy" "log" "net/http" ) func StartProxy() { verbose := flag.Bool("v", false, "should every proxy request be logged to stdout") addr := flag.String("addr", ":8080", "proxy listen address") flag.Parse() proxy := goproxy.NewProxyHttpServer() proxy.OnRequest().HandleConnect(goproxy.AlwaysMitm) proxy.OnRequest().DoFunc(func(req *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) { if req.URL.Scheme == "https" { req.URL.Scheme = "http" } return req, nil }) proxy.Verbose = *verbose log.Fatal(http.ListenAndServe(*addr, proxy)) } ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-module-mix/mvn-go-test-mix-proxy/src/com.igormaznitsa/testmixproxy/go.mod ================================================ module com.igormaznitsa/testmixproxy require github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-module-mix/mvn-go-test-mix-proxy/src/com.igormaznitsa/testmixproxy/go.sum ================================================ github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e h1:p1yVGRW3nmb85p1Sh1ZJSDm4A4iKLS5QNbvUHMgGu/M= github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-module-mix/mvn-go-test-mix-terminal/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-example-maven-module-mix 1.0.0-SNAPSHOT mvn-go-test-mix-terminal mvn-golang ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} auto ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-module-mix/mvn-go-test-mix-terminal/src/com.igormaznitsa/testmixterminal/Terminal.go ================================================ package testmixterminal import ( "log" "math" "time" ui "github.com/gizak/termui/v3" "github.com/gizak/termui/v3/widgets" ) func StartTerminal() { if err := ui.Init(); err != nil { log.Fatalf("failed to initialize termui: %v", err) } defer ui.Close() p := widgets.NewParagraph() p.Title = "Text Box" p.Text = "PRESS q TO QUIT DEMO" p.SetRect(0, 0, 50, 5) p.TextStyle.Fg = ui.ColorWhite p.BorderStyle.Fg = ui.ColorCyan updateParagraph := func(count int) { if count%2 == 0 { p.TextStyle.Fg = ui.ColorRed } else { p.TextStyle.Fg = ui.ColorWhite } } listData := []string{ "[0] gizak/termui", "[1] editbox.go", "[2] interrupt.go", "[3] keyboard.go", "[4] output.go", "[5] random_out.go", "[6] dashboard.go", "[7] nsf/termbox-go", } l := widgets.NewList() l.Title = "List" l.Rows = listData l.SetRect(0, 5, 25, 12) l.TextStyle.Fg = ui.ColorYellow g := widgets.NewGauge() g.Title = "Gauge" g.Percent = 50 g.SetRect(0, 12, 50, 15) g.BarColor = ui.ColorRed g.BorderStyle.Fg = ui.ColorWhite g.TitleStyle.Fg = ui.ColorCyan sparklineData := []float64{4, 2, 1, 6, 3, 9, 1, 4, 2, 15, 14, 9, 8, 6, 10, 13, 15, 12, 10, 5, 3, 6, 1, 7, 10, 10, 14, 13, 6, 4, 2, 1, 6, 3, 9, 1, 4, 2, 15, 14, 9, 8, 6, 10, 13, 15, 12, 10, 5, 3, 6, 1, 7, 10, 10, 14, 13, 6, 4, 2, 1, 6, 3, 9, 1, 4, 2, 15, 14, 9, 8, 6, 10, 13, 15, 12, 10, 5, 3, 6, 1, 7, 10, 10, 14, 13, 6, 4, 2, 1, 6, 3, 9, 1, 4, 2, 15, 14, 9, 8, 6, 10, 13, 15, 12, 10, 5, 3, 6, 1, 7, 10, 10, 14, 13, 6} sl := widgets.NewSparkline() sl.Title = "srv 0:" sl.Data = sparklineData sl.LineColor = ui.ColorCyan sl.TitleStyle.Fg = ui.ColorWhite sl2 := widgets.NewSparkline() sl2.Title = "srv 1:" sl2.Data = sparklineData sl2.TitleStyle.Fg = ui.ColorWhite sl2.LineColor = ui.ColorRed slg := widgets.NewSparklineGroup(sl, sl2) slg.Title = "Sparkline" slg.SetRect(25, 5, 50, 12) sinData := (func() []float64 { n := 220 ps := make([]float64, n) for i := range ps { ps[i] = 1 + math.Sin(float64(i)/5) } return ps })() lc := widgets.NewPlot() lc.Title = "dot-marker Line Chart" lc.Data = make([][]float64, 1) lc.Data[0] = sinData lc.SetRect(0, 15, 50, 25) lc.AxesColor = ui.ColorWhite lc.LineColors[0] = ui.ColorRed lc.Marker = widgets.MarkerDot barchartData := []float64{3, 2, 5, 3, 9, 5, 3, 2, 5, 8, 3, 2, 4, 5, 3, 2, 5, 7, 5, 3, 2, 6, 7, 4, 6, 3, 6, 7, 8, 3, 6, 4, 5, 3, 2, 4, 6, 4, 8, 5, 9, 4, 3, 6, 5, 3, 6} bc := widgets.NewBarChart() bc.Title = "Bar Chart" bc.SetRect(50, 0, 75, 10) bc.Labels = []string{"S0", "S1", "S2", "S3", "S4", "S5"} bc.BarColors[0] = ui.ColorGreen bc.NumStyles[0] = ui.NewStyle(ui.ColorBlack) lc2 := widgets.NewPlot() lc2.Title = "braille-mode Line Chart" lc2.Data = make([][]float64, 1) lc2.Data[0] = sinData lc2.SetRect(50, 15, 75, 25) lc2.AxesColor = ui.ColorWhite lc2.LineColors[0] = ui.ColorYellow p2 := widgets.NewParagraph() p2.Text = "Hey!\nI am a borderless block!" p2.Border = false p2.SetRect(50, 10, 75, 10) p2.TextStyle.Fg = ui.ColorMagenta draw := func(count int) { g.Percent = count % 101 l.Rows = listData[count%9:] slg.Sparklines[0].Data = sparklineData[:30+count%50] slg.Sparklines[1].Data = sparklineData[:35+count%50] lc.Data[0] = sinData[count/2%220:] lc2.Data[0] = sinData[2*count%220:] bc.Data = barchartData[count/2%10:] ui.Render(p, l, g, slg, lc, bc, lc2, p2) } tickerCount := 1 draw(tickerCount) tickerCount++ uiEvents := ui.PollEvents() ticker := time.NewTicker(time.Second).C for { select { case e := <-uiEvents: switch e.ID { case "q", "": return } case <-ticker: updateParagraph(tickerCount) draw(tickerCount) tickerCount++ } } } ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-module-mix/mvn-go-test-mix-terminal/src/com.igormaznitsa/testmixterminal/go.mod ================================================ module com.igormaznitsa/testmixterminal go 1.14 require github.com/gizak/termui/v3 v3.0.0 ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-module-mix/mvn-go-test-mix-terminal/src/com.igormaznitsa/testmixterminal/go.sum ================================================ github.com/cjbassi/drawille-go v0.0.0-20190126131713-27dc511fe6fd h1:XtfPmj9tQRilnrEmI1HjQhxXWRhEM+m8CACtaMJE/kM= github.com/cjbassi/drawille-go v0.0.0-20190126131713-27dc511fe6fd/go.mod h1:vjcQJUZJYD3MeVGhtZXSMnCHfUNZxsyYzJt90eCYxK4= github.com/gizak/termui/v3 v3.0.0 h1:NYTUG6ig/sJK05O5FyhWemwlVPO8ilNpvS/PgRtrKAE= github.com/gizak/termui/v3 v3.0.0/go.mod h1:uinu2dMdtMI+FTIdEFUJQT5y+KShnhQRshvPblXq3lY= github.com/mattn/go-runewidth v0.0.2 h1:UnlwIPBGaTZfPQ6T1IGzPI0EkYAQmT9fAEJ/poFC63o= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d h1:x3S6kxmy49zXVVyhcnrFqxvNVCBPb2KZ9hV2RBdS840= github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ= golang.org/x/arch v0.0.0-20181203225421-5a4828bb7045/go.mod h1:cYlCBUl1MsqxdiKgmc4uh7TxZfWSFLOGSRR090WDxt8= ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-module-mix/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-maven-module-mix pom Example of use maven dependency together with golang modules true mvn-go-test-mix-terminal mvn-go-test-mix-proxy mvn-go-test-mix-app ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-repository/mvn-go-test-app/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-example-maven-repository 1.0.0-SNAPSHOT mvn-go-test-app mvn-golang com.igormaznitsa mvn-go-test-lib 1.0.0-SNAPSHOT mvn-golang com.igormaznitsa mvn-go-test-libtwo 1.0.0-SNAPSHOT mvn-golang ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} auto do-vet vet do-run run off main.go ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-repository/mvn-go-test-app/src/main.go ================================================ package main import ( "com.igormaznitsa/mvngotest" "com.igormaznitsa/mvngotesttwo" ) func main() { mvngotest.SomeTestMethod() mvngotesttwo.SomeTestMethodTwo() } ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-repository/mvn-go-test-lib/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-example-maven-repository 1.0.0-SNAPSHOT mvn-go-test-lib mvn-golang com.igormaznitsa mvn-go-test-metalib 1.0.0-SNAPSHOT mvn-golang ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} archive ./... off ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-repository/mvn-go-test-lib/src/com.igormaznitsa/mvngotest/SomeUtils.go ================================================ package mvngotest import ( meta "com.igormaznitsa/mvngotestmeta" "fmt" ) var Buildstamp string var svnRevision string func SomeTestMethod() { fmt.Printf(meta.SomeMetaMethod("mvn-go-test-lib module") + "!\n") } ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-repository/mvn-go-test-lib/src/com.igormaznitsa/mvngotest/go.mod ================================================ module com.igormaznitsa/mvngotest require com.igormaznitsa/mvngotestmeta v1.0.0 replace com.igormaznitsa/mvngotestmeta => ../../../bin/.__deps__/mvn-go-test-metalib-1.0.0-SNAPSHOT/src/com.igormaznitsa/mvngotestmeta ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-repository/mvn-go-test-libtwo/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-example-maven-repository 1.0.0-SNAPSHOT mvn-go-test-libtwo mvn-golang com.igormaznitsa mvn-go-test-metalib 1.0.0-SNAPSHOT mvn-golang ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} archive ./... off ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-repository/mvn-go-test-libtwo/src/com.igormaznitsa/mvngotesttwo/SomeUtils.go ================================================ package mvngotesttwo import ( meta "com.igormaznitsa/mvngotestmeta" "fmt" ) var Buildstamp string var svnRevision string func SomeTestMethodTwo() { fmt.Printf(meta.SomeMetaMethod("mvn-go-test-libtwo module") + "!\n") } ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-repository/mvn-go-test-libtwo/src/com.igormaznitsa/mvngotesttwo/go.mod ================================================ module com.igormaznitsa/mvngotesttwo require com.igormaznitsa/mvngotestmeta v1.0.0 replace com.igormaznitsa/mvngotestmeta => ../../../bin/.__deps__/mvn-go-test-metalib-1.0.0-SNAPSHOT/src/com.igormaznitsa/mvngotestmeta ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-repository/mvn-go-test-metalib/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-example-maven-repository 1.0.0-SNAPSHOT mvn-go-test-metalib mvn-golang ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} archive ./... off ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-repository/mvn-go-test-metalib/src/com.igormaznitsa/mvngotestmeta/MetaUtils.go ================================================ package mvngotestmeta func SomeMetaMethod(arg string) string { return "Hello " + arg } ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-repository/mvn-go-test-metalib/src/com.igormaznitsa/mvngotestmeta/go.mod ================================================ module com.igormaznitsa/mvngotestmeta ================================================ FILE: mvn-golang-examples/mvn-golang-example-maven-repository/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-maven-repository pom Example of dependency from Maven repository Example how to use mvn-golang artifact saved in maven repository true false mvn-go-test-metalib mvn-go-test-lib mvn-go-test-libtwo mvn-go-test-app ================================================ FILE: mvn-golang-examples/mvn-golang-example-multimodule/app-1/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-example-multimodule 1.0-SNAPSHOT app-1 mvn-golang App-1 ${basedir}${file.separator}src ${basedir}${file.separator}bin ${basedir}${file.separator}resources com.igormaznitsa mvn-golang-wrapper ${mvn.golang.version} true ${go.sdk.version} auto ${basedir}/../common ================================================ FILE: mvn-golang-examples/mvn-golang-example-multimodule/app-1/src/main.go ================================================ package main import ( "common" ) func main() { common.PrintHello("world") } ================================================ FILE: mvn-golang-examples/mvn-golang-example-multimodule/app-1/src/main_test.go ================================================ package main import "testing" func TestMain(t *testing.T) { main() } ================================================ FILE: mvn-golang-examples/mvn-golang-example-multimodule/app-2/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-example-multimodule 1.0-SNAPSHOT app-2 mvn-golang App-2 ${basedir}${file.separator}src ${basedir}${file.separator}bin ${basedir}${file.separator}resources com.igormaznitsa mvn-golang-wrapper ${mvn.golang.version} true ${go.sdk.version} auto ${basedir}/../common ================================================ FILE: mvn-golang-examples/mvn-golang-example-multimodule/app-2/src/main.go ================================================ package main import "common" func main() { common.PrintHello("universe") } ================================================ FILE: mvn-golang-examples/mvn-golang-example-multimodule/app-2/src/main_test.go ================================================ package main import "testing" func TestMain(t *testing.T) { main() } ================================================ FILE: mvn-golang-examples/mvn-golang-example-multimodule/assembly-results/deploy.xml ================================================ dist-assembly tar.gz false false ${project.basedir}${file.separator}..${file.separator}app-1${file.separator}bin ${file.separator} app-1-${project.version} app-1-${project.version}.exe ${project.basedir}${file.separator}..${file.separator}app-2${file.separator}bin ${file.separator} app-2-${project.version} app-2-${project.version}.exe ================================================ FILE: mvn-golang-examples/mvn-golang-example-multimodule/assembly-results/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-example-multimodule 1.0-SNAPSHOT assembly-results pom Assembly results ${project.groupId} app-1 ${project.version} mvn-golang provided ${project.groupId} app-2 ${project.version} mvn-golang provided all-apps-${project.version} org.apache.maven.plugins maven-clean-plugin 3.0.0 false true ${basedir}${file.separator}target maven-assembly-plugin 3.1.0 false ${basedir}/target ${basedir}/deploy.xml create-archive package single ================================================ FILE: mvn-golang-examples/mvn-golang-example-multimodule/common/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-example-multimodule 1.0-SNAPSHOT common mvn-golang Common true true true ${basedir}${file.separator}src ${basedir}${file.separator}bin ${basedir}${file.separator}resources com.igormaznitsa mvn-golang-wrapper ${mvn.golang.version} true ${go.sdk.version} auto ================================================ FILE: mvn-golang-examples/mvn-golang-example-multimodule/common/src/common/common.go ================================================ package common import "fmt" func PrintHello(name string) { fmt.Println("Hello," + name) } ================================================ FILE: mvn-golang-examples/mvn-golang-example-multimodule/common/src/common/common_test.go ================================================ package common import "testing" func TestPrintHello(t *testing.T) { PrintHello("Igor") } ================================================ FILE: mvn-golang-examples/mvn-golang-example-multimodule/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-multimodule 1.0-SNAPSHOT pom UTF-8 ${main-project-version} common app-1 app-2 assembly-results ================================================ FILE: mvn-golang-examples/mvn-golang-example-nes/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-nes mvn-golang NES emulator example Example of mvn-golang-wrapper usage to build the NES emulator project : https://github.com/fogleman/nes ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true default-get -u true github.com/gordonklaus/portaudio github.com/fogleman/nes default-build If error with native parts then install them with : sudo apt-get install portaudio19-dev libgl1-mesa-dev xorg-dev github.com/fogleman/nes ${go.sdk.version} auto ================================================ FILE: mvn-golang-examples/mvn-golang-example-oak-shooter/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-oak-shooter 1.0.0-SNAPSHOT mvn-golang Oak shooter example Example of Oak engine based 2D shooter. ${basedir}${file.separator}src ${basedir}${file.separator}bin org.apache.maven.plugins maven-resources-plugin 3.2.0 copy-resources package copy-resources ${project.build.directory} ${project.basedir}${file.separator}resources com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} true mod default-fix none ================================================ FILE: mvn-golang-examples/mvn-golang-example-oak-shooter/src/go.mod ================================================ module github.com/mycodesmells/golang-examples/modules go 1.16 require github.com/oakmound/oak/v2 v2.5.0 ================================================ FILE: mvn-golang-examples/mvn-golang-example-oak-shooter/src/go.sum ================================================ github.com/200sc/go-dist v1.0.0 h1:Y9bl++4+d8NFv5hzwHyaxbXZmexVCic/rUdQOTq7Jec= github.com/200sc/go-dist v1.0.0/go.mod h1:+hhVw6j4BQF2HPwLFmsVM4VooSH9sn04apvH52hfboU= github.com/200sc/klangsynthese v0.2.2-0.20201022002431-a0e14a8c862b h1:6Gk8u6eHdE6Xcn3t3BDei1e83FUUw6eH/LhOiDECHr0= github.com/200sc/klangsynthese v0.2.2-0.20201022002431-a0e14a8c862b/go.mod h1:1yEA6LmYbsEoAPJx+JN+UQk7k5yXebfWsuM1yGPK/3s= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/BurntSushi/xgbutil v0.0.0-20160919175755-f7c97cef3b4e/go.mod h1:uw9h2sd4WWHOPdJ13MQpwK5qYWKYDumDqxWWIknEQ+k= github.com/BurntSushi/xgbutil v0.0.0-20190907113008-ad855c713046 h1:O/r2Sj+8QcMF7V5IcmiE2sMFV2q3J47BEirxbXJAdzA= github.com/BurntSushi/xgbutil v0.0.0-20190907113008-ad855c713046/go.mod h1:uw9h2sd4WWHOPdJ13MQpwK5qYWKYDumDqxWWIknEQ+k= github.com/akavel/polyclip-go v0.0.0-20160111220610-2cfdb71461bd h1:/DQAi5feF/aviHBeEK8mS1D/bm6gNFlUFtDkX0L7jOU= github.com/akavel/polyclip-go v0.0.0-20160111220610-2cfdb71461bd/go.mod h1:GwtPRvP/jvUpifg23D1jSVP93pV0cSV9fWOn9sG+HEo= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/disintegration/gift v1.2.0 h1:VMQeei2F+ZtsHjMgP6Sdt1kFjRhs2lGz8ljEOPeIR50= github.com/disintegration/gift v1.2.0/go.mod h1:Jh2i7f7Q2BM7Ezno3PhfezbR1xpUg9dUg3/RlKGr4HI= github.com/eaburns/bit v0.0.0-20131029213740-7bd5cd37375d/go.mod h1:CHkHWWZ4kbGY6jEy1+qlitDaCtRgNvCOQdakj/1Yl/Q= github.com/eaburns/flac v0.0.0-20171003200620-9a6fb92396d1/go.mod h1:frG94byMNy+1CgGrQ25dZ+17tf98EN+OYBQL4Zh612M= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/hajimehoshi/go-mp3 v0.3.1 h1:pn/SKU1+/rfK8KaZXdGEC2G/KCB2aLRjbTCrwKcokao= github.com/hajimehoshi/go-mp3 v0.3.1/go.mod h1:qMJj/CSDxx6CGHiZeCgbiq2DSUkbK0UbtXShQcnfyMM= github.com/hajimehoshi/oto v0.6.1/go.mod h1:0QXGEkbuJRohbJaxr7ZQSxnju7hEhseiPx2hrh6raOI= github.com/oakmound/libudev v0.2.1 h1:gaXuw7Pbt3RSRxbUakAjl0dSW6Wo3TZWpwS5aMq8+EA= github.com/oakmound/libudev v0.2.1/go.mod h1:zYF5CkHY+UP6lzWbPR+XoVAscl/s+OncWA//qWjMLUs= github.com/oakmound/oak/v2 v2.5.0 h1:gib2faJi7tOFsa9+vcEtnRWQGGJo8/4zRv35XMVhYL4= github.com/oakmound/oak/v2 v2.5.0/go.mod h1:4L4o4tQ3fGnEcXJ4lROTbbJsj6I5X11+/VaIOzGO7s8= github.com/oakmound/shiny v0.4.2 h1:QfkgNG4ktT0g8wTM6bjWn1uAPOBk6NoQVxD/Bvwt5xk= github.com/oakmound/shiny v0.4.2/go.mod h1:fEGagtAluRRrVkMQyzyL+G3j+TdsyOjrIajWunGmy3M= github.com/oakmound/w32 v2.0.0+incompatible/go.mod h1:lzloWlclSXIU4cDr67WF8qjFFDO8gHHBIk4Qqe90enQ= github.com/oakmound/w32 v2.1.0+incompatible/go.mod h1:lzloWlclSXIU4cDr67WF8qjFFDO8gHHBIk4Qqe90enQ= github.com/oov/directsound-go v0.0.0-20141101201356-e53e59c700bf/go.mod h1:RBXkZ8n2vvtdJP6PO+TbU/N/DVuCDwUN53CU+C1pJOs= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/yobert/alsa v0.0.0-20200618200352-d079056f5370 h1:I8PHpJWTMTJZVDoosy8aXslFGe7wvcUbol7fOrVy4Tc= github.com/yobert/alsa v0.0.0-20200618200352-d079056f5370/go.mod h1:CaowXBWOiSGWEpBBV8LoVnQTVPV4ycyviC9IBLj8dRw= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20201208152932-35266b937fa6 h1:nfeHNc1nAqecKCy2FCy4HY+soOOe5sDLJ/gZLbx6GYI= golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/mobile v0.0.0-20190307202846-d2e1c1c4a691/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190415191353-3e0bab5405d6 h1:vyLBGJPIl9ZYbcQFM2USFmJBK6KI+t+z6jL0lbwjrnc= golang.org/x/mobile v0.0.0-20190415191353-3e0bab5405d6/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/net v0.0.0-20190310074541-c10a0554eabf/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6 h1:bjcUS9ztw9kFmmIxJInhon/0Is3p+EHBKNgquIzo1OI= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190310054646-10058d7d4faa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190429190828-d89cdac9e872/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= ================================================ FILE: mvn-golang-examples/mvn-golang-example-oak-shooter/src/performance.go ================================================ package main import ( "image/color" "math/rand" "path/filepath" "time" "github.com/oakmound/oak/v2/render/mod" oak "github.com/oakmound/oak/v2" "github.com/oakmound/oak/v2/alg/floatgeom" "github.com/oakmound/oak/v2/collision" "github.com/oakmound/oak/v2/collision/ray" "github.com/oakmound/oak/v2/dlog" "github.com/oakmound/oak/v2/entities" "github.com/oakmound/oak/v2/event" "github.com/oakmound/oak/v2/key" "github.com/oakmound/oak/v2/mouse" "github.com/oakmound/oak/v2/physics" "github.com/oakmound/oak/v2/render" "github.com/oakmound/oak/v2/scene" ) const ( Enemy collision.Label = 1 ) var ( playerAlive = true // Vectors are backed by pointers, // so despite this not being a pointer, // this does update according to the player's // position so long as we don't reset // the player's position vector playerPos physics.Vector sheet [][]*render.Sprite ) const ( fieldWidth = 1000 fieldHeight = 1000 ) func main() { oak.Add("tds", func(string, interface{}) { // Initialization playerAlive = true var err error sprites, err := render.GetSheet(filepath.Join("16x16", "sheet.png")) dlog.ErrorCheck(err) sheet = sprites.ToSprites() oak.SetViewportBounds(0, 0, fieldWidth, fieldHeight) // Player setup eggplant, err := render.GetSprite(filepath.Join("character", "eggplant-fish.png")) playerR := render.NewSwitch("left", map[string]render.Modifiable{ "left": eggplant, // We must copy the sprite before we modify it, or "left" // will also be flipped. "right": eggplant.Copy().Modify(mod.FlipX), }) if err != nil { dlog.Error(err) } char := entities.NewMoving(100, 100, 32, 32, playerR, nil, 0, 0) char.Speed = physics.NewVector(5, 5) playerPos = char.Point.Vector render.Draw(char.R, 1, 2) char.Bind(func(id int, _ interface{}) int { char := event.GetEntity(id).(*entities.Moving) char.Delta.Zero() if oak.IsDown(key.W) { char.Delta.ShiftY(-char.Speed.Y()) } if oak.IsDown(key.A) { char.Delta.ShiftX(-char.Speed.X()) } if oak.IsDown(key.S) { char.Delta.ShiftY(char.Speed.Y()) } if oak.IsDown(key.D) { char.Delta.ShiftX(char.Speed.X()) } char.ShiftPos(char.Delta.X(), char.Delta.Y()) // Don't go out of bounds if char.X() < 0 { char.SetX(0) } else if char.X() > fieldWidth-char.W { char.SetX(fieldWidth - char.W) } if char.Y() < 0 { char.SetY(0) } else if char.Y() > fieldHeight-char.H { char.SetY(fieldHeight - char.H) } oak.SetScreen( int(char.R.X())-oak.ScreenWidth/2, int(char.R.Y())-oak.ScreenHeight/2, ) hit := char.HitLabel(Enemy) if hit != nil { playerAlive = false } // update animation swtch := char.R.(*render.Switch) if char.Delta.X() > 0 { if swtch.Get() == "left" { swtch.Set("right") } } else if char.Delta.X() < 0 { if swtch.Get() == "right" { swtch.Set("left") } } return 0 }, event.Enter) char.Bind(func(id int, me interface{}) int { char := event.GetEntity(id).(*entities.Moving) mevent := me.(mouse.Event) x := char.X() + char.W/2 y := char.Y() + char.H/2 mx := mevent.X() + float64(oak.ViewPos.X) my := mevent.Y() + float64(oak.ViewPos.Y) ray.DefaultCaster.CastDistance = floatgeom.Point2{x, y}.Sub(floatgeom.Point2{mx, my}).Magnitude() hits := ray.CastTo(floatgeom.Point2{x, y}, floatgeom.Point2{mx, my}) for _, hit := range hits { hit.Zone.CID.Trigger("Destroy", nil) } render.DrawForTime( render.NewLine(x, y, mx, my, color.RGBA{0, 128, 0, 128}), time.Millisecond*50, 1, 2) return 0 }, mouse.Press) // Create enemies periodically event.GlobalBind(func(_ int, frames interface{}) int { f := frames.(int) if f%EnemyRefresh == 0 { NewEnemy() } return 0 }, event.Enter) // Draw the background for x := 0; x < fieldWidth; x += 16 { for y := 0; y < fieldHeight; y += 16 { i := rand.Intn(3) + 1 // Get a random tile to draw in this position sp := sheet[i/2][i%2].Copy() sp.SetPos(float64(x), float64(y)) render.Draw(sp, 0, 1) } } }, func() bool { return playerAlive }, func() (string, *scene.Result) { return "tds", nil }) // This indicates to oak to automatically open and load image and audio // files local to the project before starting any scene. oak.SetupConfig.BatchLoad = true render.SetDrawStack( render.NewCompositeR(), render.NewHeap(false), render.NewDrawFPS(), render.NewLogicFPS(), ) oak.Init("tds") } // Top down shooter consts const ( EnemyRefresh = 25 EnemySpeed = 2 ) // NewEnemy creates an enemy for a top down shooter func NewEnemy() { x, y := enemyPos() enemyFrame := sheet[0][0].Copy() enemyR := render.NewSwitch("left", map[string]render.Modifiable{ "left": enemyFrame, "right": enemyFrame.Copy().Modify(mod.FlipX), }) enemy := entities.NewSolid(x, y, 16, 16, enemyR, nil, 0) render.Draw(enemy.R, 1, 2) enemy.UpdateLabel(Enemy) enemy.Bind(func(id int, _ interface{}) int { enemy := event.GetEntity(id).(*entities.Solid) // move towards the player x, y := enemy.GetPos() pt := floatgeom.Point2{x, y} pt2 := floatgeom.Point2{playerPos.X(), playerPos.Y()} delta := pt2.Sub(pt).Normalize().MulConst(EnemySpeed) enemy.ShiftPos(delta.X(), delta.Y()) // update animation swtch := enemy.R.(*render.Switch) if delta.X() > 0 { if swtch.Get() == "left" { swtch.Set("right") } } else if delta.X() < 0 { if swtch.Get() == "right" { swtch.Set("left") } } return 0 }, event.Enter) enemy.Bind(func(id int, _ interface{}) int { enemy := event.GetEntity(id).(*entities.Solid) enemy.Destroy() return 0 }, "Destroy") } func enemyPos() (float64, float64) { // Spawn on the edge of the screen perimeter := fieldWidth*2 + fieldHeight*2 pos := int(rand.Float64() * float64(perimeter)) // Top if pos < fieldWidth { return float64(pos), 0 } pos -= fieldWidth // Right if pos < fieldHeight { return float64(fieldWidth), float64(pos) } // Bottom pos -= fieldHeight if pos < fieldWidth { return float64(pos), float64(fieldHeight) } pos -= fieldWidth // Left return 0, float64(pos) } ================================================ FILE: mvn-golang-examples/mvn-golang-example-plugin/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-plugin 1.0.0-SNAPSHOT mvn-golang GoLang plugin example Example of minimalistic GoLang plugin. so build-for-windows windows dll go_plugin.${result.file.extension} ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} auto default-build plugin ================================================ FILE: mvn-golang-examples/mvn-golang-example-plugin/src/arithplugin.go ================================================ package main func Add(x, y int) int { return x + y } func Sub(x, y int) int { return x - y } ================================================ FILE: mvn-golang-examples/mvn-golang-example-plugin/src/arithplugin_test.go ================================================ package main import ( "testing" ) func TestAdd(t *testing.T) { if Add(4, 7) != 11 { t.Fatalf("Wrong Add result") } } func TestSub(t *testing.T) { if Sub(4, 7) != -3 { t.Fatalf("Wrong Sub result") } } ================================================ FILE: mvn-golang-examples/mvn-golang-example-preprocessing/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-preprocessing 1.0.0-SNAPSHOT mvn-golang Example of preprocessing Example of Java Comment Preprocessor with GoLang. ${project.build.directory}${file.separator}.preprocessed_src ${basedir}${file.separator}src ${basedir}${file.separator}bin org.codehaus.mojo buildnumber-maven-plugin 1.4 generateTimestampForBuild validate create-timestamp yyMMddHHmmss org.apache.maven.plugins maven-clean-plugin 3.0.0 false true ${src.preprocessed} com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} ${src.preprocessed} auto default-fix initialize run main.go com.igormaznitsa jcp 7.0.5 preprocessGoSources validate preprocess go txt png false true ${src.preprocessed} ${timestamp} Iteration number is ================================================ FILE: mvn-golang-examples/mvn-golang-example-preprocessing/src/inlined.go ================================================ //#excludeif true //#- package main import ( "bytes" "fmt" "image/png" "log" ) func main() { //#+ var imageArray = []uint8{/*$binfile("./image.png","uint8[]s")$*/} var imageConfig, errDecode = png.DecodeConfig(bytes.NewBuffer(imageArray)) if errDecode != nil { log.Fatal(errDecode) } fmt.Printf("Embedded image has size %dx%d\n", imageConfig.Width, imageConfig.Height) //#local text=str2java(evalfile("./text.txt"),false) fmt.Println( /*$"\""+text+"\""$*/ ) //#- } //#+ ================================================ FILE: mvn-golang-examples/mvn-golang-example-preprocessing/src/main.go ================================================ package main import ( "bytes" "fmt" "image/png" "log" ) func main() { fmt.Printf("Example of preprocessing GoLang sources with Java Comment Preprocessor\n") fmt.Printf("Project version is : /*$mvn.project.version$*/\n") fmt.Printf("Build timestamp is : /*$timeStamp$*/\n\n") //#local counter=1 //#while counter<=10 fmt.Println("/*$txtMsg$*/ /*$counter$*/") //#local counter=counter+1 //#end //#include "./inlined.go" } ================================================ FILE: mvn-golang-examples/mvn-golang-example-preprocessing/src/text.txt ================================================ The Text is defined in external text UTF8 resource file! Он содержит и странные русские буквы (для непосвященных) и даже Ё! ================================================ FILE: mvn-golang-examples/mvn-golang-example-primitive/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-primitive mvn-golang Primitive converting utility Example of mvn-golang-wrapper usage to build the Primitive project: https://github.com/fogleman/primitive ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true default-get -u github.com/fogleman/primitive default-build github.com/fogleman/primitive ${go.sdk.version} auto ================================================ FILE: mvn-golang-examples/mvn-golang-example-protobuf/go-dependencies.lst ================================================ package:github.com/golang/protobuf/proto ================================================ FILE: mvn-golang-examples/mvn-golang-example-protobuf/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-protobuf mvn-golang Protobuf with Golang example Example of compilation and use of protobuf script. ${project.build.directory}${file.separator}.protoGen win-profile windows .exe ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} auto ${proto.gen.folder} get-protoc-get-go generate-sources get -u github.com/golang/protobuf/protoc-gen-go default-get ${basedir}${file.separator}go-dependencies.lst do-run run main.go com.github.os72 protoc-jar-maven-plugin 3.11.4 generate-go-from-proto generate-sources run go ${project.build.directory}${file.separator}protoc-gen-go${os.extension} ${basedir}${file.separator}proto ${proto.gen.folder}${file.separator}src${file.separator}protoexample ================================================ FILE: mvn-golang-examples/mvn-golang-example-protobuf/proto/person.proto ================================================ syntax="proto3"; package protoexample; option go_package="github.com/raydac"; message Person { string name = 1; int32 age = 2; } ================================================ FILE: mvn-golang-examples/mvn-golang-example-protobuf/src/main.go ================================================ package main import ( "fmt" "github.com/golang/protobuf/proto" "log" protoexample "protoexample/github.com/raydac" ) func main() { elliot := &protoexample.Person{ Name: "Elliot", Age: 24, } data, err := proto.Marshal(elliot) if err != nil { log.Fatal("marshaling error: ", err) } // printing out our raw protobuf object fmt.Println(data) // let's go the other way and unmarshal // our byte array into an object we can modify // and use newElliot := &protoexample.Person{} err = proto.Unmarshal(data, newElliot) if err != nil { log.Fatal("unmarshaling error: ", err) } // print out our `newElliot` object // for good measure fmt.Println(newElliot.GetAge()) fmt.Println(newElliot.GetName()) } ================================================ FILE: mvn-golang-examples/mvn-golang-example-termboxgo/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-termboxgo mvn-golang TERMBOX-GO example Example of TERMBOX-GO https://github.com/nsf/termbox-go ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} auto default-get github.com/nsf/termbox-go ================================================ FILE: mvn-golang-examples/mvn-golang-example-termboxgo/src/main.go ================================================ package main import "github.com/nsf/termbox-go" import "fmt" type key struct { x int y int ch rune } var K_ESC = []key{{1, 1, 'E'}, {2, 1, 'S'}, {3, 1, 'C'}} var K_F1 = []key{{6, 1, 'F'}, {7, 1, '1'}} var K_F2 = []key{{9, 1, 'F'}, {10, 1, '2'}} var K_F3 = []key{{12, 1, 'F'}, {13, 1, '3'}} var K_F4 = []key{{15, 1, 'F'}, {16, 1, '4'}} var K_F5 = []key{{19, 1, 'F'}, {20, 1, '5'}} var K_F6 = []key{{22, 1, 'F'}, {23, 1, '6'}} var K_F7 = []key{{25, 1, 'F'}, {26, 1, '7'}} var K_F8 = []key{{28, 1, 'F'}, {29, 1, '8'}} var K_F9 = []key{{33, 1, 'F'}, {34, 1, '9'}} var K_F10 = []key{{36, 1, 'F'}, {37, 1, '1'}, {38, 1, '0'}} var K_F11 = []key{{40, 1, 'F'}, {41, 1, '1'}, {42, 1, '1'}} var K_F12 = []key{{44, 1, 'F'}, {45, 1, '1'}, {46, 1, '2'}} var K_PRN = []key{{50, 1, 'P'}, {51, 1, 'R'}, {52, 1, 'N'}} var K_SCR = []key{{54, 1, 'S'}, {55, 1, 'C'}, {56, 1, 'R'}} var K_BRK = []key{{58, 1, 'B'}, {59, 1, 'R'}, {60, 1, 'K'}} var K_LED1 = []key{{66, 1, '-'}} var K_LED2 = []key{{70, 1, '-'}} var K_LED3 = []key{{74, 1, '-'}} var K_TILDE = []key{{1, 4, '`'}} var K_TILDE_SHIFT = []key{{1, 4, '~'}} var K_1 = []key{{4, 4, '1'}} var K_1_SHIFT = []key{{4, 4, '!'}} var K_2 = []key{{7, 4, '2'}} var K_2_SHIFT = []key{{7, 4, '@'}} var K_3 = []key{{10, 4, '3'}} var K_3_SHIFT = []key{{10, 4, '#'}} var K_4 = []key{{13, 4, '4'}} var K_4_SHIFT = []key{{13, 4, '$'}} var K_5 = []key{{16, 4, '5'}} var K_5_SHIFT = []key{{16, 4, '%'}} var K_6 = []key{{19, 4, '6'}} var K_6_SHIFT = []key{{19, 4, '^'}} var K_7 = []key{{22, 4, '7'}} var K_7_SHIFT = []key{{22, 4, '&'}} var K_8 = []key{{25, 4, '8'}} var K_8_SHIFT = []key{{25, 4, '*'}} var K_9 = []key{{28, 4, '9'}} var K_9_SHIFT = []key{{28, 4, '('}} var K_0 = []key{{31, 4, '0'}} var K_0_SHIFT = []key{{31, 4, ')'}} var K_MINUS = []key{{34, 4, '-'}} var K_MINUS_SHIFT = []key{{34, 4, '_'}} var K_EQUALS = []key{{37, 4, '='}} var K_EQUALS_SHIFT = []key{{37, 4, '+'}} var K_BACKSLASH = []key{{40, 4, '\\'}} var K_BACKSLASH_SHIFT = []key{{40, 4, '|'}} var K_BACKSPACE = []key{{44, 4, 0x2190}, {45, 4, 0x2500}, {46, 4, 0x2500}} var K_INS = []key{{50, 4, 'I'}, {51, 4, 'N'}, {52, 4, 'S'}} var K_HOM = []key{{54, 4, 'H'}, {55, 4, 'O'}, {56, 4, 'M'}} var K_PGU = []key{{58, 4, 'P'}, {59, 4, 'G'}, {60, 4, 'U'}} var K_K_NUMLOCK = []key{{65, 4, 'N'}} var K_K_SLASH = []key{{68, 4, '/'}} var K_K_STAR = []key{{71, 4, '*'}} var K_K_MINUS = []key{{74, 4, '-'}} var K_TAB = []key{{1, 6, 'T'}, {2, 6, 'A'}, {3, 6, 'B'}} var K_q = []key{{6, 6, 'q'}} var K_Q = []key{{6, 6, 'Q'}} var K_w = []key{{9, 6, 'w'}} var K_W = []key{{9, 6, 'W'}} var K_e = []key{{12, 6, 'e'}} var K_E = []key{{12, 6, 'E'}} var K_r = []key{{15, 6, 'r'}} var K_R = []key{{15, 6, 'R'}} var K_t = []key{{18, 6, 't'}} var K_T = []key{{18, 6, 'T'}} var K_y = []key{{21, 6, 'y'}} var K_Y = []key{{21, 6, 'Y'}} var K_u = []key{{24, 6, 'u'}} var K_U = []key{{24, 6, 'U'}} var K_i = []key{{27, 6, 'i'}} var K_I = []key{{27, 6, 'I'}} var K_o = []key{{30, 6, 'o'}} var K_O = []key{{30, 6, 'O'}} var K_p = []key{{33, 6, 'p'}} var K_P = []key{{33, 6, 'P'}} var K_LSQB = []key{{36, 6, '['}} var K_LCUB = []key{{36, 6, '{'}} var K_RSQB = []key{{39, 6, ']'}} var K_RCUB = []key{{39, 6, '}'}} var K_ENTER = []key{ {43, 6, 0x2591}, {44, 6, 0x2591}, {45, 6, 0x2591}, {46, 6, 0x2591}, {43, 7, 0x2591}, {44, 7, 0x2591}, {45, 7, 0x21B5}, {46, 7, 0x2591}, {41, 8, 0x2591}, {42, 8, 0x2591}, {43, 8, 0x2591}, {44, 8, 0x2591}, {45, 8, 0x2591}, {46, 8, 0x2591}, } var K_DEL = []key{{50, 6, 'D'}, {51, 6, 'E'}, {52, 6, 'L'}} var K_END = []key{{54, 6, 'E'}, {55, 6, 'N'}, {56, 6, 'D'}} var K_PGD = []key{{58, 6, 'P'}, {59, 6, 'G'}, {60, 6, 'D'}} var K_K_7 = []key{{65, 6, '7'}} var K_K_8 = []key{{68, 6, '8'}} var K_K_9 = []key{{71, 6, '9'}} var K_K_PLUS = []key{{74, 6, ' '}, {74, 7, '+'}, {74, 8, ' '}} var K_CAPS = []key{{1, 8, 'C'}, {2, 8, 'A'}, {3, 8, 'P'}, {4, 8, 'S'}} var K_a = []key{{7, 8, 'a'}} var K_A = []key{{7, 8, 'A'}} var K_s = []key{{10, 8, 's'}} var K_S = []key{{10, 8, 'S'}} var K_d = []key{{13, 8, 'd'}} var K_D = []key{{13, 8, 'D'}} var K_f = []key{{16, 8, 'f'}} var K_F = []key{{16, 8, 'F'}} var K_g = []key{{19, 8, 'g'}} var K_G = []key{{19, 8, 'G'}} var K_h = []key{{22, 8, 'h'}} var K_H = []key{{22, 8, 'H'}} var K_j = []key{{25, 8, 'j'}} var K_J = []key{{25, 8, 'J'}} var K_k = []key{{28, 8, 'k'}} var K_K = []key{{28, 8, 'K'}} var K_l = []key{{31, 8, 'l'}} var K_L = []key{{31, 8, 'L'}} var K_SEMICOLON = []key{{34, 8, ';'}} var K_PARENTHESIS = []key{{34, 8, ':'}} var K_QUOTE = []key{{37, 8, '\''}} var K_DOUBLEQUOTE = []key{{37, 8, '"'}} var K_K_4 = []key{{65, 8, '4'}} var K_K_5 = []key{{68, 8, '5'}} var K_K_6 = []key{{71, 8, '6'}} var K_LSHIFT = []key{{1, 10, 'S'}, {2, 10, 'H'}, {3, 10, 'I'}, {4, 10, 'F'}, {5, 10, 'T'}} var K_z = []key{{9, 10, 'z'}} var K_Z = []key{{9, 10, 'Z'}} var K_x = []key{{12, 10, 'x'}} var K_X = []key{{12, 10, 'X'}} var K_c = []key{{15, 10, 'c'}} var K_C = []key{{15, 10, 'C'}} var K_v = []key{{18, 10, 'v'}} var K_V = []key{{18, 10, 'V'}} var K_b = []key{{21, 10, 'b'}} var K_B = []key{{21, 10, 'B'}} var K_n = []key{{24, 10, 'n'}} var K_N = []key{{24, 10, 'N'}} var K_m = []key{{27, 10, 'm'}} var K_M = []key{{27, 10, 'M'}} var K_COMMA = []key{{30, 10, ','}} var K_LANB = []key{{30, 10, '<'}} var K_PERIOD = []key{{33, 10, '.'}} var K_RANB = []key{{33, 10, '>'}} var K_SLASH = []key{{36, 10, '/'}} var K_QUESTION = []key{{36, 10, '?'}} var K_RSHIFT = []key{{42, 10, 'S'}, {43, 10, 'H'}, {44, 10, 'I'}, {45, 10, 'F'}, {46, 10, 'T'}} var K_ARROW_UP = []key{{54, 10, '('}, {55, 10, 0x2191}, {56, 10, ')'}} var K_K_1 = []key{{65, 10, '1'}} var K_K_2 = []key{{68, 10, '2'}} var K_K_3 = []key{{71, 10, '3'}} var K_K_ENTER = []key{{74, 10, 0x2591}, {74, 11, 0x2591}, {74, 12, 0x2591}} var K_LCTRL = []key{{1, 12, 'C'}, {2, 12, 'T'}, {3, 12, 'R'}, {4, 12, 'L'}} var K_LWIN = []key{{6, 12, 'W'}, {7, 12, 'I'}, {8, 12, 'N'}} var K_LALT = []key{{10, 12, 'A'}, {11, 12, 'L'}, {12, 12, 'T'}} var K_SPACE = []key{ {14, 12, ' '}, {15, 12, ' '}, {16, 12, ' '}, {17, 12, ' '}, {18, 12, ' '}, {19, 12, 'S'}, {20, 12, 'P'}, {21, 12, 'A'}, {22, 12, 'C'}, {23, 12, 'E'}, {24, 12, ' '}, {25, 12, ' '}, {26, 12, ' '}, {27, 12, ' '}, {28, 12, ' '}, } var K_RALT = []key{{30, 12, 'A'}, {31, 12, 'L'}, {32, 12, 'T'}} var K_RWIN = []key{{34, 12, 'W'}, {35, 12, 'I'}, {36, 12, 'N'}} var K_RPROP = []key{{38, 12, 'P'}, {39, 12, 'R'}, {40, 12, 'O'}, {41, 12, 'P'}} var K_RCTRL = []key{{43, 12, 'C'}, {44, 12, 'T'}, {45, 12, 'R'}, {46, 12, 'L'}} var K_ARROW_LEFT = []key{{50, 12, '('}, {51, 12, 0x2190}, {52, 12, ')'}} var K_ARROW_DOWN = []key{{54, 12, '('}, {55, 12, 0x2193}, {56, 12, ')'}} var K_ARROW_RIGHT = []key{{58, 12, '('}, {59, 12, 0x2192}, {60, 12, ')'}} var K_K_0 = []key{{65, 12, ' '}, {66, 12, '0'}, {67, 12, ' '}, {68, 12, ' '}} var K_K_PERIOD = []key{{71, 12, '.'}} type combo struct { keys [][]key } var combos = []combo{ {[][]key{K_TILDE, K_2, K_SPACE, K_LCTRL, K_RCTRL}}, {[][]key{K_A, K_LCTRL, K_RCTRL}}, {[][]key{K_B, K_LCTRL, K_RCTRL}}, {[][]key{K_C, K_LCTRL, K_RCTRL}}, {[][]key{K_D, K_LCTRL, K_RCTRL}}, {[][]key{K_E, K_LCTRL, K_RCTRL}}, {[][]key{K_F, K_LCTRL, K_RCTRL}}, {[][]key{K_G, K_LCTRL, K_RCTRL}}, {[][]key{K_H, K_BACKSPACE, K_LCTRL, K_RCTRL}}, {[][]key{K_I, K_TAB, K_LCTRL, K_RCTRL}}, {[][]key{K_J, K_LCTRL, K_RCTRL}}, {[][]key{K_K, K_LCTRL, K_RCTRL}}, {[][]key{K_L, K_LCTRL, K_RCTRL}}, {[][]key{K_M, K_ENTER, K_K_ENTER, K_LCTRL, K_RCTRL}}, {[][]key{K_N, K_LCTRL, K_RCTRL}}, {[][]key{K_O, K_LCTRL, K_RCTRL}}, {[][]key{K_P, K_LCTRL, K_RCTRL}}, {[][]key{K_Q, K_LCTRL, K_RCTRL}}, {[][]key{K_R, K_LCTRL, K_RCTRL}}, {[][]key{K_S, K_LCTRL, K_RCTRL}}, {[][]key{K_T, K_LCTRL, K_RCTRL}}, {[][]key{K_U, K_LCTRL, K_RCTRL}}, {[][]key{K_V, K_LCTRL, K_RCTRL}}, {[][]key{K_W, K_LCTRL, K_RCTRL}}, {[][]key{K_X, K_LCTRL, K_RCTRL}}, {[][]key{K_Y, K_LCTRL, K_RCTRL}}, {[][]key{K_Z, K_LCTRL, K_RCTRL}}, {[][]key{K_LSQB, K_ESC, K_3, K_LCTRL, K_RCTRL}}, {[][]key{K_4, K_BACKSLASH, K_LCTRL, K_RCTRL}}, {[][]key{K_RSQB, K_5, K_LCTRL, K_RCTRL}}, {[][]key{K_6, K_LCTRL, K_RCTRL}}, {[][]key{K_7, K_SLASH, K_MINUS_SHIFT, K_LCTRL, K_RCTRL}}, {[][]key{K_SPACE}}, {[][]key{K_1_SHIFT, K_LSHIFT, K_RSHIFT}}, {[][]key{K_DOUBLEQUOTE, K_LSHIFT, K_RSHIFT}}, {[][]key{K_3_SHIFT, K_LSHIFT, K_RSHIFT}}, {[][]key{K_4_SHIFT, K_LSHIFT, K_RSHIFT}}, {[][]key{K_5_SHIFT, K_LSHIFT, K_RSHIFT}}, {[][]key{K_7_SHIFT, K_LSHIFT, K_RSHIFT}}, {[][]key{K_QUOTE}}, {[][]key{K_9_SHIFT, K_LSHIFT, K_RSHIFT}}, {[][]key{K_0_SHIFT, K_LSHIFT, K_RSHIFT}}, {[][]key{K_8_SHIFT, K_K_STAR, K_LSHIFT, K_RSHIFT}}, {[][]key{K_EQUALS_SHIFT, K_K_PLUS, K_LSHIFT, K_RSHIFT}}, {[][]key{K_COMMA}}, {[][]key{K_MINUS, K_K_MINUS}}, {[][]key{K_PERIOD, K_K_PERIOD}}, {[][]key{K_SLASH, K_K_SLASH}}, {[][]key{K_0, K_K_0}}, {[][]key{K_1, K_K_1}}, {[][]key{K_2, K_K_2}}, {[][]key{K_3, K_K_3}}, {[][]key{K_4, K_K_4}}, {[][]key{K_5, K_K_5}}, {[][]key{K_6, K_K_6}}, {[][]key{K_7, K_K_7}}, {[][]key{K_8, K_K_8}}, {[][]key{K_9, K_K_9}}, {[][]key{K_PARENTHESIS, K_LSHIFT, K_RSHIFT}}, {[][]key{K_SEMICOLON}}, {[][]key{K_LANB, K_LSHIFT, K_RSHIFT}}, {[][]key{K_EQUALS}}, {[][]key{K_RANB, K_LSHIFT, K_RSHIFT}}, {[][]key{K_QUESTION, K_LSHIFT, K_RSHIFT}}, {[][]key{K_2_SHIFT, K_LSHIFT, K_RSHIFT}}, {[][]key{K_A, K_LSHIFT, K_RSHIFT}}, {[][]key{K_B, K_LSHIFT, K_RSHIFT}}, {[][]key{K_C, K_LSHIFT, K_RSHIFT}}, {[][]key{K_D, K_LSHIFT, K_RSHIFT}}, {[][]key{K_E, K_LSHIFT, K_RSHIFT}}, {[][]key{K_F, K_LSHIFT, K_RSHIFT}}, {[][]key{K_G, K_LSHIFT, K_RSHIFT}}, {[][]key{K_H, K_LSHIFT, K_RSHIFT}}, {[][]key{K_I, K_LSHIFT, K_RSHIFT}}, {[][]key{K_J, K_LSHIFT, K_RSHIFT}}, {[][]key{K_K, K_LSHIFT, K_RSHIFT}}, {[][]key{K_L, K_LSHIFT, K_RSHIFT}}, {[][]key{K_M, K_LSHIFT, K_RSHIFT}}, {[][]key{K_N, K_LSHIFT, K_RSHIFT}}, {[][]key{K_O, K_LSHIFT, K_RSHIFT}}, {[][]key{K_P, K_LSHIFT, K_RSHIFT}}, {[][]key{K_Q, K_LSHIFT, K_RSHIFT}}, {[][]key{K_R, K_LSHIFT, K_RSHIFT}}, {[][]key{K_S, K_LSHIFT, K_RSHIFT}}, {[][]key{K_T, K_LSHIFT, K_RSHIFT}}, {[][]key{K_U, K_LSHIFT, K_RSHIFT}}, {[][]key{K_V, K_LSHIFT, K_RSHIFT}}, {[][]key{K_W, K_LSHIFT, K_RSHIFT}}, {[][]key{K_X, K_LSHIFT, K_RSHIFT}}, {[][]key{K_Y, K_LSHIFT, K_RSHIFT}}, {[][]key{K_Z, K_LSHIFT, K_RSHIFT}}, {[][]key{K_LSQB}}, {[][]key{K_BACKSLASH}}, {[][]key{K_RSQB}}, {[][]key{K_6_SHIFT, K_LSHIFT, K_RSHIFT}}, {[][]key{K_MINUS_SHIFT, K_LSHIFT, K_RSHIFT}}, {[][]key{K_TILDE}}, {[][]key{K_a}}, {[][]key{K_b}}, {[][]key{K_c}}, {[][]key{K_d}}, {[][]key{K_e}}, {[][]key{K_f}}, {[][]key{K_g}}, {[][]key{K_h}}, {[][]key{K_i}}, {[][]key{K_j}}, {[][]key{K_k}}, {[][]key{K_l}}, {[][]key{K_m}}, {[][]key{K_n}}, {[][]key{K_o}}, {[][]key{K_p}}, {[][]key{K_q}}, {[][]key{K_r}}, {[][]key{K_s}}, {[][]key{K_t}}, {[][]key{K_u}}, {[][]key{K_v}}, {[][]key{K_w}}, {[][]key{K_x}}, {[][]key{K_y}}, {[][]key{K_z}}, {[][]key{K_LCUB, K_LSHIFT, K_RSHIFT}}, {[][]key{K_BACKSLASH_SHIFT, K_LSHIFT, K_RSHIFT}}, {[][]key{K_RCUB, K_LSHIFT, K_RSHIFT}}, {[][]key{K_TILDE_SHIFT, K_LSHIFT, K_RSHIFT}}, {[][]key{K_8, K_BACKSPACE, K_LCTRL, K_RCTRL}}, } var func_combos = []combo{ {[][]key{K_F1}}, {[][]key{K_F2}}, {[][]key{K_F3}}, {[][]key{K_F4}}, {[][]key{K_F5}}, {[][]key{K_F6}}, {[][]key{K_F7}}, {[][]key{K_F8}}, {[][]key{K_F9}}, {[][]key{K_F10}}, {[][]key{K_F11}}, {[][]key{K_F12}}, {[][]key{K_INS}}, {[][]key{K_DEL}}, {[][]key{K_HOM}}, {[][]key{K_END}}, {[][]key{K_PGU}}, {[][]key{K_PGD}}, {[][]key{K_ARROW_UP}}, {[][]key{K_ARROW_DOWN}}, {[][]key{K_ARROW_LEFT}}, {[][]key{K_ARROW_RIGHT}}, } func print_tb(x, y int, fg, bg termbox.Attribute, msg string) { for _, c := range msg { termbox.SetCell(x, y, c, fg, bg) x++ } } func printf_tb(x, y int, fg, bg termbox.Attribute, format string, args ...interface{}) { s := fmt.Sprintf(format, args...) print_tb(x, y, fg, bg, s) } func draw_key(k []key, fg, bg termbox.Attribute) { for _, k := range k { termbox.SetCell(k.x+2, k.y+4, k.ch, fg, bg) } } func draw_keyboard() { termbox.SetCell(0, 0, 0x250C, termbox.ColorWhite, termbox.ColorBlack) termbox.SetCell(79, 0, 0x2510, termbox.ColorWhite, termbox.ColorBlack) termbox.SetCell(0, 23, 0x2514, termbox.ColorWhite, termbox.ColorBlack) termbox.SetCell(79, 23, 0x2518, termbox.ColorWhite, termbox.ColorBlack) for i := 1; i < 79; i++ { termbox.SetCell(i, 0, 0x2500, termbox.ColorWhite, termbox.ColorBlack) termbox.SetCell(i, 23, 0x2500, termbox.ColorWhite, termbox.ColorBlack) termbox.SetCell(i, 17, 0x2500, termbox.ColorWhite, termbox.ColorBlack) termbox.SetCell(i, 4, 0x2500, termbox.ColorWhite, termbox.ColorBlack) } for i := 1; i < 23; i++ { termbox.SetCell(0, i, 0x2502, termbox.ColorWhite, termbox.ColorBlack) termbox.SetCell(79, i, 0x2502, termbox.ColorWhite, termbox.ColorBlack) } termbox.SetCell(0, 17, 0x251C, termbox.ColorWhite, termbox.ColorBlack) termbox.SetCell(79, 17, 0x2524, termbox.ColorWhite, termbox.ColorBlack) termbox.SetCell(0, 4, 0x251C, termbox.ColorWhite, termbox.ColorBlack) termbox.SetCell(79, 4, 0x2524, termbox.ColorWhite, termbox.ColorBlack) for i := 5; i < 17; i++ { termbox.SetCell(1, i, 0x2588, termbox.ColorYellow, termbox.ColorYellow) termbox.SetCell(78, i, 0x2588, termbox.ColorYellow, termbox.ColorYellow) } draw_key(K_ESC, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_F1, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_F2, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_F3, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_F4, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_F5, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_F6, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_F7, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_F8, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_F9, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_F10, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_F11, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_F12, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_PRN, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_SCR, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_BRK, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_LED1, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_LED2, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_LED3, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_TILDE, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_1, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_2, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_3, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_4, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_5, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_6, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_7, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_8, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_9, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_0, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_MINUS, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_EQUALS, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_BACKSLASH, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_BACKSPACE, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_INS, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_HOM, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_PGU, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_K_NUMLOCK, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_K_SLASH, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_K_STAR, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_K_MINUS, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_TAB, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_q, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_w, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_e, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_r, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_t, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_y, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_u, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_i, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_o, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_p, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_LSQB, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_RSQB, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_ENTER, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_DEL, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_END, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_PGD, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_K_7, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_K_8, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_K_9, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_K_PLUS, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_CAPS, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_a, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_s, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_d, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_f, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_g, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_h, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_j, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_k, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_l, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_SEMICOLON, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_QUOTE, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_K_4, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_K_5, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_K_6, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_LSHIFT, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_z, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_x, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_c, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_v, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_b, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_n, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_m, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_COMMA, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_PERIOD, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_SLASH, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_RSHIFT, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_ARROW_UP, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_K_1, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_K_2, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_K_3, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_K_ENTER, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_LCTRL, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_LWIN, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_LALT, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_SPACE, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_RCTRL, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_RPROP, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_RWIN, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_RALT, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_ARROW_LEFT, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_ARROW_DOWN, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_ARROW_RIGHT, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_K_0, termbox.ColorWhite, termbox.ColorBlue) draw_key(K_K_PERIOD, termbox.ColorWhite, termbox.ColorBlue) printf_tb(33, 1, termbox.ColorMagenta|termbox.AttrBold, termbox.ColorBlack, "Keyboard demo!") printf_tb(21, 2, termbox.ColorMagenta, termbox.ColorBlack, "(press CTRL+X and then CTRL+Q to exit)") printf_tb(15, 3, termbox.ColorMagenta, termbox.ColorBlack, "(press CTRL+X and then CTRL+C to change input mode)") inputmode := termbox.SetInputMode(termbox.InputCurrent) inputmode_str := "" switch { case inputmode&termbox.InputEsc != 0: inputmode_str = "termbox.InputEsc" case inputmode&termbox.InputAlt != 0: inputmode_str = "termbox.InputAlt" } if inputmode&termbox.InputMouse != 0 { inputmode_str += " | termbox.InputMouse" } printf_tb(3, 18, termbox.ColorWhite, termbox.ColorBlack, "Input mode: %s", inputmode_str) } var fcmap = []string{ "CTRL+2, CTRL+~", "CTRL+A", "CTRL+B", "CTRL+C", "CTRL+D", "CTRL+E", "CTRL+F", "CTRL+G", "CTRL+H, BACKSPACE", "CTRL+I, TAB", "CTRL+J", "CTRL+K", "CTRL+L", "CTRL+M, ENTER", "CTRL+N", "CTRL+O", "CTRL+P", "CTRL+Q", "CTRL+R", "CTRL+S", "CTRL+T", "CTRL+U", "CTRL+V", "CTRL+W", "CTRL+X", "CTRL+Y", "CTRL+Z", "CTRL+3, ESC, CTRL+[", "CTRL+4, CTRL+\\", "CTRL+5, CTRL+]", "CTRL+6", "CTRL+7, CTRL+/, CTRL+_", "SPACE", } var fkmap = []string{ "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "INSERT", "DELETE", "HOME", "END", "PGUP", "PGDN", "ARROW UP", "ARROW DOWN", "ARROW LEFT", "ARROW RIGHT", } func funckeymap(k termbox.Key) string { if k == termbox.KeyCtrl8 { return "CTRL+8, BACKSPACE 2" /* 0x7F */ } else if k >= termbox.KeyArrowRight && k <= 0xFFFF { return fkmap[0xFFFF-k] } else if k <= termbox.KeySpace { return fcmap[k] } return "UNKNOWN" } func pretty_print_press(ev *termbox.Event) { printf_tb(3, 19, termbox.ColorWhite, termbox.ColorBlack, "Key: ") printf_tb(8, 19, termbox.ColorYellow, termbox.ColorBlack, "decimal: %d", ev.Key) printf_tb(8, 20, termbox.ColorGreen, termbox.ColorBlack, "hex: 0x%X", ev.Key) printf_tb(8, 21, termbox.ColorCyan, termbox.ColorBlack, "octal: 0%o", ev.Key) printf_tb(8, 22, termbox.ColorRed, termbox.ColorBlack, "string: %s", funckeymap(ev.Key)) printf_tb(54, 19, termbox.ColorWhite, termbox.ColorBlack, "Char: ") printf_tb(60, 19, termbox.ColorYellow, termbox.ColorBlack, "decimal: %d", ev.Ch) printf_tb(60, 20, termbox.ColorGreen, termbox.ColorBlack, "hex: 0x%X", ev.Ch) printf_tb(60, 21, termbox.ColorCyan, termbox.ColorBlack, "octal: 0%o", ev.Ch) printf_tb(60, 22, termbox.ColorRed, termbox.ColorBlack, "string: %s", string(ev.Ch)) modifier := "none" if ev.Mod != 0 { modifier = "termbox.ModAlt" } printf_tb(54, 18, termbox.ColorWhite, termbox.ColorBlack, "Modifier: %s", modifier) } func pretty_print_resize(ev *termbox.Event) { printf_tb(3, 19, termbox.ColorWhite, termbox.ColorBlack, "Resize event: %d x %d", ev.Width, ev.Height) } var counter = 0 func pretty_print_mouse(ev *termbox.Event) { printf_tb(3, 19, termbox.ColorWhite, termbox.ColorBlack, "Mouse event: %d x %d", ev.MouseX, ev.MouseY) button := "" switch ev.Key { case termbox.MouseLeft: button = "MouseLeft: %d" case termbox.MouseMiddle: button = "MouseMiddle: %d" case termbox.MouseRight: button = "MouseRight: %d" case termbox.MouseWheelUp: button = "MouseWheelUp: %d" case termbox.MouseWheelDown: button = "MouseWheelDown: %d" case termbox.MouseRelease: button = "MouseRelease: %d" } if ev.Mod&termbox.ModMotion != 0 { button += "*" } counter++ printf_tb(43, 19, termbox.ColorWhite, termbox.ColorBlack, "Key: ") printf_tb(48, 19, termbox.ColorYellow, termbox.ColorBlack, button, counter) } func dispatch_press(ev *termbox.Event) { if ev.Mod&termbox.ModAlt != 0 { draw_key(K_LALT, termbox.ColorWhite, termbox.ColorRed) draw_key(K_RALT, termbox.ColorWhite, termbox.ColorRed) } var k *combo if ev.Key >= termbox.KeyArrowRight { k = &func_combos[0xFFFF-ev.Key] } else if ev.Ch < 128 { if ev.Ch == 0 && ev.Key < 128 { k = &combos[ev.Key] } else { k = &combos[ev.Ch] } } if k == nil { return } keys := k.keys for _, k := range keys { draw_key(k, termbox.ColorWhite, termbox.ColorRed) } } func main() { err := termbox.Init() if err != nil { panic(err) } defer termbox.Close() termbox.SetInputMode(termbox.InputEsc | termbox.InputMouse) termbox.Clear(termbox.ColorDefault, termbox.ColorDefault) draw_keyboard() termbox.Flush() inputmode := 0 ctrlxpressed := false loop: for { switch ev := termbox.PollEvent(); ev.Type { case termbox.EventKey: if ev.Key == termbox.KeyCtrlS && ctrlxpressed { termbox.Sync() } if ev.Key == termbox.KeyCtrlQ && ctrlxpressed { break loop } if ev.Key == termbox.KeyCtrlC && ctrlxpressed { chmap := []termbox.InputMode{ termbox.InputEsc | termbox.InputMouse, termbox.InputAlt | termbox.InputMouse, termbox.InputEsc, termbox.InputAlt, } inputmode++ if inputmode >= len(chmap) { inputmode = 0 } termbox.SetInputMode(chmap[inputmode]) } if ev.Key == termbox.KeyCtrlX { ctrlxpressed = true } else { ctrlxpressed = false } termbox.Clear(termbox.ColorDefault, termbox.ColorDefault) draw_keyboard() dispatch_press(&ev) pretty_print_press(&ev) termbox.Flush() case termbox.EventResize: termbox.Clear(termbox.ColorDefault, termbox.ColorDefault) draw_keyboard() pretty_print_resize(&ev) termbox.Flush() case termbox.EventMouse: termbox.Clear(termbox.ColorDefault, termbox.ColorDefault) draw_keyboard() pretty_print_mouse(&ev) termbox.Flush() case termbox.EventError: panic(ev.Err) } } } ================================================ FILE: mvn-golang-examples/mvn-golang-example-termui/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT mvn-golang-example-termui mvn-golang TermUI example Example of mvn-golang-wrapper usage to build a application with getting of some external dependency. It builds a sample from https://github.com/gizak/termui ${go.sdk.version} ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true true ================================================ FILE: mvn-golang-examples/mvn-golang-example-termui/src/go.mod ================================================ module github.com/raydac/mvn-golang/examples/termui require github.com/gizak/termui/v3 v3.0.0 ================================================ FILE: mvn-golang-examples/mvn-golang-example-termui/src/go.sum ================================================ github.com/cjbassi/drawille-go v0.0.0-20190126131713-27dc511fe6fd h1:XtfPmj9tQRilnrEmI1HjQhxXWRhEM+m8CACtaMJE/kM= github.com/cjbassi/drawille-go v0.0.0-20190126131713-27dc511fe6fd/go.mod h1:vjcQJUZJYD3MeVGhtZXSMnCHfUNZxsyYzJt90eCYxK4= github.com/gizak/termui/v3 v3.0.0 h1:NYTUG6ig/sJK05O5FyhWemwlVPO8ilNpvS/PgRtrKAE= github.com/gizak/termui/v3 v3.0.0/go.mod h1:uinu2dMdtMI+FTIdEFUJQT5y+KShnhQRshvPblXq3lY= github.com/mattn/go-runewidth v0.0.2 h1:UnlwIPBGaTZfPQ6T1IGzPI0EkYAQmT9fAEJ/poFC63o= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d h1:x3S6kxmy49zXVVyhcnrFqxvNVCBPb2KZ9hV2RBdS840= github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ= golang.org/x/arch v0.0.0-20181203225421-5a4828bb7045/go.mod h1:cYlCBUl1MsqxdiKgmc4uh7TxZfWSFLOGSRR090WDxt8= ================================================ FILE: mvn-golang-examples/mvn-golang-example-termui/src/sparklines.go ================================================ // Copyright 2017 Zack Guo . All rights reserved. // Use of this source code is governed by a MIT license that can // be found in the LICENSE file. package main import ( "log" ui "github.com/gizak/termui/v3" "github.com/gizak/termui/v3/widgets" ) func main() { if err := ui.Init(); err != nil { log.Fatalf("failed to initialize termui: %v", err) } defer ui.Close() data := []float64{4, 2, 1, 6, 3, 9, 1, 4, 2, 15, 14, 9, 8, 6, 10, 13, 15, 12, 10, 5, 3, 6, 1, 7, 10, 10, 14, 13, 6} sl0 := widgets.NewSparkline() sl0.Data = data[3:] sl0.LineColor = ui.ColorGreen // single slg0 := widgets.NewSparklineGroup(sl0) slg0.Title = "Sparkline 0" slg0.SetRect(0, 0, 20, 10) sl1 := widgets.NewSparkline() sl1.Title = "Sparkline 1" sl1.Data = data sl1.LineColor = ui.ColorRed sl2 := widgets.NewSparkline() sl2.Title = "Sparkline 2" sl2.Data = data[5:] sl2.LineColor = ui.ColorMagenta slg1 := widgets.NewSparklineGroup(sl0, sl1, sl2) slg1.Title = "Group Sparklines" slg1.SetRect(0, 10, 25, 25) sl3 := widgets.NewSparkline() sl3.Title = "Enlarged Sparkline" sl3.Data = data sl3.LineColor = ui.ColorYellow slg2 := widgets.NewSparklineGroup(sl3) slg2.Title = "Tweeked Sparkline" slg2.SetRect(20, 0, 50, 10) slg2.BorderStyle.Fg = ui.ColorCyan ui.Render(slg0, slg1, slg2) uiEvents := ui.PollEvents() for { e := <-uiEvents switch e.ID { case "q", "": return } } } ================================================ FILE: mvn-golang-examples/mvn-golang-example-testing/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT ${project.build.directory}${file.separator}reports${file.separator}xunit.xml mvn-golang-example-testing 1.0.0-SNAPSHOT mvn-golang Example of Testing Example of usage of mvn-golang-wrapper for testing Golang project and XUnit report producing. ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} auto getTestDependencies get -t ./... default-get github.com/tebeka/go2xunit default-test -v test-out-verbose.log true makeXUnitReport test custom go2xunit -fail -input ${project.build.directory}${file.separator}reports${file.separator}test-out-verbose.log -output ${xunit.report} XUnit report saved as ${xunit.report} ================================================ FILE: mvn-golang-examples/mvn-golang-example-testing/src/main.go ================================================ package main import ( "fmt" "mypackage/testexample" ) func main() { fmt.Printf("%s %d\n", testexample.GetString(), testexample.GetInt()) } ================================================ FILE: mvn-golang-examples/mvn-golang-example-testing/src/mypackage/testexample/Some.go ================================================ package testexample func GetString() string { return "Hello String" } func GetInt() int { return 768 } func MakeSumm(a, b int) int { return a + b } ================================================ FILE: mvn-golang-examples/mvn-golang-example-testing/src/mypackage/testexample/Some_test.go ================================================ package testexample import ( "github.com/stretchr/testify/assert" "testing" ) func TestGetString(t *testing.T) { assert.Equal(t, "Hello String", GetString()) } func TestGetInt(t *testing.T) { assert.Equal(t, 768, GetInt()) } func TestMakeSumm(t *testing.T) { assert.Equal(t, 7, MakeSumm(2, 5)) } ================================================ FILE: mvn-golang-examples/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang 2.3.11-SNAPSHOT mvn-golang-examples pom 1.0.0-SNAPSHOT 1.21.7 examples-under-unix unix mvn-golang-example-nes mvn-golang-example-gui mvn-golang-example-primitive mvn-golang-example-plugin examples Set of examples for mvn-golang-wrapper org.apache.maven.plugins maven-clean-plugin 3.0.0 false true ${basedir}${file.separator}pkg ${basedir}${file.separator}.jfrog mvn-golang-example-gui-gwt mvn-golang-example-preprocessing mvn-golang-example-fyne mvn-golang-example-helloworld mvn-golang-example-helloworld-gomod mvn-golang-example-helloworld-multisrc mvn-golang-example-genbindata mvn-golang-example-goexample mvn-golang-example-termui mvn-golang-example-logrus mvn-golang-example-goterm mvn-golang-example-multimodule mvn-golang-example-testing mvn-golang-example-gocui mvn-golang-example-clui mvn-golang-example-termboxgo mvn-golang-example-maven-repository mvn-golang-example-maven-module-mix mvn-golang-example-protobuf mvn-golang-example-azul3d-mandelbrot mvn-golang-example-oak-shooter test-git-cvs ================================================ FILE: mvn-golang-examples/test-git-cvs/cvs-git-branch-master/pom.xml ================================================ 4.0.0 com.igormaznitsa test-git-cvs 1.0.0-SNAPSHOT cvs-git-branch-master 1.0.0-SNAPSHOT mvn-golang Test of loading main branch UTF-8 ${project.groupId} cvs-git-revision ${project.version} mvn-golang test ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} ${src.preprocessed} auto default-build -a default-fix initialize default-get true github.com/raydac/mvn-golang-cvs-test run main.go ================================================ FILE: mvn-golang-examples/test-git-cvs/cvs-git-branch-master/src/main.go ================================================ package main import "github.com/raydac/mvn-golang-cvs-test" import "fmt" func main() { fmt.Printf(mvngolangcvstest.GetSomeText()) if mvngolangcvstest.GetSomeText() != "some_text_master_current" { panic("Wrong value, expected 'some_text_master_current'") } } ================================================ FILE: mvn-golang-examples/test-git-cvs/cvs-git-branch-v2/pom.xml ================================================ 4.0.0 com.igormaznitsa test-git-cvs 1.0.0-SNAPSHOT cvs-git-branch-v2 1.0.0-SNAPSHOT mvn-golang Test of loading non-main branch UTF-8 ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} ${src.preprocessed} auto default-build -a default-fix initialize default-get true github.com/raydac/mvn-golang-cvs-test v2 run main.go ================================================ FILE: mvn-golang-examples/test-git-cvs/cvs-git-branch-v2/src/main.go ================================================ package main import "github.com/raydac/mvn-golang-cvs-test" import "fmt" func main() { fmt.Printf(mvngolangcvstest.GetSomeText()) if mvngolangcvstest.GetSomeText() != "some_text_version2" { panic("Wrong value, expected 'some_text_version2'") } } ================================================ FILE: mvn-golang-examples/test-git-cvs/cvs-git-custom/pom.xml ================================================ 4.0.0 com.igormaznitsa test-git-cvs 1.0.0-SNAPSHOT cvs-git-custom 1.0.0-SNAPSHOT mvn-golang Test of loading main branch with tag UTF-8 ${project.groupId} cvs-git-master-tag ${project.version} mvn-golang test ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} ${src.preprocessed} auto default-build -a default-fix initialize default-get github.com/raydac/mvn-golang-cvs-test true checkout -B master tags/master_tag1 run main.go ================================================ FILE: mvn-golang-examples/test-git-cvs/cvs-git-custom/src/main.go ================================================ package main import "github.com/raydac/mvn-golang-cvs-test" import "fmt" func main() { fmt.Printf(mvngolangcvstest.GetSomeText()) if mvngolangcvstest.GetSomeText() != "some_text_master_tagged" { panic("Wrong value, expected 'some_text_master_tagged'") } } ================================================ FILE: mvn-golang-examples/test-git-cvs/cvs-git-master-tag/pom.xml ================================================ 4.0.0 com.igormaznitsa test-git-cvs 1.0.0-SNAPSHOT cvs-git-master-tag 1.0.0-SNAPSHOT mvn-golang Test of loading main branch with tag UTF-8 ${project.groupId} cvs-git-branch-master ${project.version} mvn-golang test ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} ${src.preprocessed} auto default-build -a default-fix initialize default-get true github.com/raydac/mvn-golang-cvs-test master master_tag1 run main.go ================================================ FILE: mvn-golang-examples/test-git-cvs/cvs-git-master-tag/src/main.go ================================================ package main import "github.com/raydac/mvn-golang-cvs-test" import "fmt" func main() { fmt.Printf(mvngolangcvstest.GetSomeText()) if mvngolangcvstest.GetSomeText() != "some_text_master_tagged" { panic("Wrong value, expected 'some_text_master_tagged'") } } ================================================ FILE: mvn-golang-examples/test-git-cvs/cvs-git-revision/pom.xml ================================================ 4.0.0 com.igormaznitsa test-git-cvs 1.0.0-SNAPSHOT cvs-git-revision 1.0.0-SNAPSHOT mvn-golang Test of loading revision UTF-8 ${project.groupId} cvs-git-branch-v2 ${project.version} mvn-golang test ${basedir}${file.separator}src ${basedir}${file.separator}bin com.igormaznitsa mvn-golang-wrapper ${main-project-version} true ${go.sdk.version} ${src.preprocessed} auto default-build -a default-fix initialize default-get true github.com/raydac/mvn-golang-cvs-test 53dca7f87202ae2c34b897b80e5f7c1a9bed12ad run main.go ================================================ FILE: mvn-golang-examples/test-git-cvs/cvs-git-revision/src/main.go ================================================ package main import "github.com/raydac/mvn-golang-cvs-test" import "fmt" func main() { fmt.Printf(mvngolangcvstest.GetSomeText()) if mvngolangcvstest.GetSomeText() != "some_text" { panic("Wrong value, expected 'some_text'") } } ================================================ FILE: mvn-golang-examples/test-git-cvs/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang-examples 1.0.0-SNAPSHOT test-git-cvs pom Test of 'get' for different identifiers in GIT repository cvs-git-branch-v2 cvs-git-revision cvs-git-branch-master cvs-git-master-tag cvs-git-custom ================================================ FILE: mvn-golang-hello/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang 2.3.11-SNAPSHOT com.igormaznitsa mvn-golang-hello jar Maven GoLang archetype Archetype generates a sample mvn-golang project publish org.apache.maven.plugins maven-assembly-plugin 3.1.1 make-distributive install single false ${project.artifactId}-${project.version}-${maven.build.timestamp}-distr src/assemble/distribution.xml make-bundle install single src/assemble/bundle.xml com.igormaznitsa uber-pom ${uber.pom}
parent
modules
profiles/profile/modules
true
upom
org.apache.maven.plugins maven-source-plugin 3.1.0 generate-sources package jar org.apache.maven.plugins maven-javadoc-plugin 3.1.1 generate-javadoc package jar 8 org.apache.maven.plugins maven-gpg-plugin 1.6 sign-artifacts verify sign
================================================ FILE: mvn-golang-hello/src/assemble/bundle.xml ================================================ bundle false false jar ${project.build.directory} / *.jar.asc *.jar *.pom *.pom.asc original*.* *.zip ================================================ FILE: mvn-golang-hello/src/assemble/distribution.xml ================================================ distr false false tar.gz ${project.basedir} /project target/ texts/ nbactions.xml catalog.xml **/.* /lib ${project.basedir}/target ${project.build.finalName}.jar /lib ${project.basedir} pom.xml / ${basedir}/texts *.* ================================================ FILE: mvn-golang-hello/src/main/resources/META-INF/maven/archetype-metadata.xml ================================================ main 2.3.11-SNAPSHOT 1.21.7 res bin src **/*.go **/*.mod *.xml *.txt ================================================ FILE: mvn-golang-hello/src/main/resources/archetype-resources/packages.txt ================================================ // this fle can contain dependencies in format // package: [,branch: ][, tag: ][, revision: ] // example: // package:github.com/gizak/termui, branch:v2 ================================================ FILE: mvn-golang-hello/src/main/resources/archetype-resources/pom.xml ================================================ #set($dollar = '$') #set($str = "") #set($dt = $str.getClass().forName("java.util.Date").newInstance()) #set($year = $dt.getYear() + 1900) 4.0.0 ${groupId} ${artifactId} ${version} mvn-golang Hello GoLang Simple 'Hello World!' GoLang example https://github.com/raydac/mvn-golang ${gosdk} ${dollar}{basedir}${dollar}{file.separator}packages.txt ${gowrapper} UTF-8 yyyyMMddHHmm 3.0 ${year} The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt repo ${dollar}{mvn.version} windows-profile windows .exe clean package ${dollar}{project.artifactId}-${dollar}{maven.build.timestamp}${dollar}{final.extension} ${dollar}{basedir}${dollar}{file.separator}src ${dollar}{basedir}${dollar}{file.separator}bin ${dollar}{basedir}${dollar}{file.separator}res com.igormaznitsa mvn-golang-wrapper ${dollar}{go.wrapper.plugin.version} true default-build
hello.go
golang-run verify run hello.go
================================================ FILE: mvn-golang-hello/src/main/resources/archetype-resources/src/go.mod ================================================ module github.com/raydac/mvn-golang/example/hello ================================================ FILE: mvn-golang-hello/src/main/resources/archetype-resources/src/hello.go ================================================ package ${package} import "fmt" func Hello(text string) string { return text } func main() { fmt.Printf(Hello("Hello, world.\n")) } ================================================ FILE: mvn-golang-hello/src/main/resources/archetype-resources/src/hello_test.go ================================================ package ${package} import "testing" func TestHello(t *testing.T) { str := Hello("xxx") if str != "xxx" { t.Fail() } } ================================================ FILE: mvn-golang-hello-multi/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang 2.3.11-SNAPSHOT com.igormaznitsa mvn-golang-hello-multi jar Maven GoLang Multi-module archetype Archetype generates a sample multi-module mvn-golang project publish org.apache.maven.plugins maven-assembly-plugin 3.1.1 make-distributive install single false ${project.artifactId}-${project.version}-${maven.build.timestamp}-distr src/assemble/distribution.xml make-bundle install single src/assemble/bundle.xml com.igormaznitsa uber-pom ${uber.pom}
parent
modules
profiles/profile/modules
true
upom
org.apache.maven.plugins maven-source-plugin 3.1.0 generate-sources package jar org.apache.maven.plugins maven-javadoc-plugin 3.1.1 generate-javadoc package jar 8 org.apache.maven.plugins maven-gpg-plugin 1.6 sign-artifacts verify sign
================================================ FILE: mvn-golang-hello-multi/src/assemble/bundle.xml ================================================ bundle false false jar ${project.build.directory} / *.jar.asc *.jar *.pom *.pom.asc original*.* *.zip ================================================ FILE: mvn-golang-hello-multi/src/assemble/distribution.xml ================================================ distr false false tar.gz ${project.basedir} /project target/ texts/ nbactions.xml catalog.xml **/.* /lib ${project.basedir}/target ${project.build.finalName}.jar /lib ${project.basedir} pom.xml / ${basedir}/texts *.* ================================================ FILE: mvn-golang-hello-multi/src/main/resources/META-INF/maven/archetype-metadata.xml ================================================ main 2.3.11-SNAPSHOT 1.21.7 app-1/res app-1/src **/*.go app-1 *.iml *.xml app-2/res app-2/src **/*.go app-2 *.iml *.xml common/res common/src **/*.go common *.iml *.xml assembly-results *.xml *.xml ================================================ FILE: mvn-golang-hello-multi/src/main/resources/archetype-resources/app-1/pom.xml ================================================ #set($dollar = '$') #set($str = "") #set($dt = $str.getClass().forName("java.util.Date").newInstance()) #set($year = $dt.getYear() + 1900) 4.0.0 ${groupId} ${artifactId} ${version} ${artifactId}-app-1 mvn-golang App-1 ${groupId} ${artifactId}-common ${version} mvn-golang ${dollar}{basedir}${dollar}{file.separator}src ${dollar}{basedir}${dollar}{file.separator}bin ${dollar}{project.artifactId}-${dollar}{project.version}${dollar}{final.extension} ${dollar}{basedir}${dollar}{file.separator}res com.igormaznitsa mvn-golang-wrapper ================================================ FILE: mvn-golang-hello-multi/src/main/resources/archetype-resources/app-1/src/main.go ================================================ package main import ( "common" ) func main() { common.PrintHello("world") } ================================================ FILE: mvn-golang-hello-multi/src/main/resources/archetype-resources/app-1/src/main_test.go ================================================ package main import "testing" func TestMain(t *testing.T) { main() } ================================================ FILE: mvn-golang-hello-multi/src/main/resources/archetype-resources/app-2/pom.xml ================================================ #set($dollar = '$') #set($str = "") #set($dt = $str.getClass().forName("java.util.Date").newInstance()) #set($year = $dt.getYear() + 1900) 4.0.0 ${groupId} ${artifactId} ${version} ${artifactId}-app-2 mvn-golang App-2 ${groupId} ${artifactId}-common ${version} mvn-golang ${dollar}{basedir}${dollar}{file.separator}src ${dollar}{basedir}${dollar}{file.separator}bin ${dollar}{project.artifactId}-${dollar}{project.version}${dollar}{final.extension} ${dollar}{basedir}${dollar}{file.separator}res com.igormaznitsa mvn-golang-wrapper ================================================ FILE: mvn-golang-hello-multi/src/main/resources/archetype-resources/app-2/src/main.go ================================================ package main import "common" func main() { common.PrintHello("universe") } ================================================ FILE: mvn-golang-hello-multi/src/main/resources/archetype-resources/app-2/src/main_test.go ================================================ package main import "testing" func TestMain(t *testing.T) { main() } ================================================ FILE: mvn-golang-hello-multi/src/main/resources/archetype-resources/assembly-results/deploy.xml ================================================ dist-assembly tar.gz false false ${project.basedir}/../app-1/bin / ${artifactId}-app-1-${project.version} ${artifactId}-app-1-${project.version}.exe ${project.basedir}/../app-2/bin / ${artifactId}-app-2-${project.version} ${artifactId}-app-2-${project.version}.exe ================================================ FILE: mvn-golang-hello-multi/src/main/resources/archetype-resources/assembly-results/pom.xml ================================================ #set($dollar = '$') #set($str = "") #set($dt = $str.getClass().forName("java.util.Date").newInstance()) #set($year = $dt.getYear() + 1900) 4.0.0 ${groupId} ${artifactId} ${version} ${artifactId}-assembly-results pom Assembly results ${dollar}{project.groupId} ${artifactId}-app-1 ${dollar}{project.version} mvn-golang ${dollar}{project.groupId} ${artifactId}-app-2 ${dollar}{project.version} mvn-golang all-apps-${dollar}{project.version} org.apache.maven.plugins maven-clean-plugin 3.0.0 false true ${dollar}{basedir}${dollar}{file.separator}target maven-assembly-plugin 3.1.0 false ${dollar}{basedir}/target ${dollar}{basedir}/deploy.xml create-archive package single ================================================ FILE: mvn-golang-hello-multi/src/main/resources/archetype-resources/common/pom.xml ================================================ #set($dollar = '$') #set($str = "") #set($dt = $str.getClass().forName("java.util.Date").newInstance()) #set($year = $dt.getYear() + 1900) 4.0.0 ${groupId} ${artifactId} ${version} ${artifactId}-common mvn-golang Common ${dollar}{basedir}${dollar}{file.separator}src ${dollar}{basedir}${dollar}{file.separator}bin ${dollar}{basedir}${dollar}{file.separator}res com.igormaznitsa mvn-golang-wrapper default-build none ================================================ FILE: mvn-golang-hello-multi/src/main/resources/archetype-resources/common/src/common/common.go ================================================ package common import "fmt" func PrintHello(name string) { fmt.Println("Hello," + name) } ================================================ FILE: mvn-golang-hello-multi/src/main/resources/archetype-resources/common/src/common/common_test.go ================================================ package common import "testing" func TestPrintHello(t *testing.T) { PrintHello("Igor") } ================================================ FILE: mvn-golang-hello-multi/src/main/resources/archetype-resources/pom.xml ================================================ #set($dollar = '$') #set($str = "") #set($dt = $str.getClass().forName("java.util.Date").newInstance()) #set($year = $dt.getYear() + 1900) 4.0.0 ${groupId} ${artifactId} ${version} pom UTF-8 ${gosdk} ${gowrapper} yyyyMMddHHmm 3.0 ${dollar}{mvn.version} windows-profile Windows .exe assembly assembly-results common app-1 app-2 clean package com.igormaznitsa mvn-golang-wrapper ${dollar}{go.wrapper.plugin.version} true off ================================================ FILE: mvn-golang-wrapper/pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang 2.3.11-SNAPSHOT mvn-golang-wrapper maven-plugin mvn-golang-wrapper ${mvn.version} joda-time joda-time 2.12.7 com.igormaznitsa meta-annotations ${meta.version} com.igormaznitsa meta-utils ${meta.version} commons-io commons-io 2.16.1 org.apache.maven.plugin-tools maven-plugin-annotations 3.5 provided org.apache.maven maven-plugin-api ${mvn.version} provided org.apache.maven maven-core ${mvn.version} provided org.apache.maven.shared maven-artifact-transfer 0.11.0 org.slf4j slf4j-api commons-codec commons-codec org.codehaus.plexus plexus-component-annotations commons-io commons-io org.apache.maven maven-compat 3.0 test org.apache.maven.plugin-testing maven-plugin-testing-harness 2.1 test org.apache.maven.shared maven-verifier 1.8.0 test org.zeroturnaround zt-exec 1.12 commons-io commons-io org.slf4j slf4j-api org.zeroturnaround zt-zip 1.17 org.slf4j slf4j-api org.apache.commons commons-compress 1.26.2 commons-codec commons-codec commons-codec commons-codec 1.17.1 org.apache.commons commons-lang3 3.14.0 org.apache.httpcomponents httpclient 4.5.14 commons-codec commons-codec org.slf4j slf4j-api 1.7.36 org.slf4j slf4j-nop 1.7.36 publish org.apache.maven.plugins maven-assembly-plugin make-distributive install single false ${project.artifactId}-${project.version}-${maven.build.timestamp}-distr src/assemble/distribution.xml make-bundle install single src/assemble/bundle.xml com.igormaznitsa uber-pom ${uber.pom}
parent
modules
profiles/profile/modules
true
upom
org.apache.maven.plugins maven-source-plugin generate-sources package jar-no-fork org.apache.maven.plugins maven-javadoc-plugin generate-javadoc package jar 8 org.apache.maven.plugins maven-gpg-plugin sign-artifacts verify sign
src/main/filtered-resources true org.apache.maven.plugins maven-enforcer-plugin 3.5.0 enforce-no-duplicate-dependencies enforce org.apache.maven.* org.codehaus.plexus org.codehaus.mojo extra-enforcer-rules 1.8.0 org.codehaus.mojo animal-sniffer-maven-plugin 1.24 org.codehaus.mojo.signature java18 1.0 ensure-java-1.8-class-library test check com.igormaznitsa meta-checker ${meta.version} 8 true true risky *.HelpMojo check org.apache.maven.plugins maven-plugin-plugin mojo-descriptor process-classes descriptor helpmojo
================================================ FILE: mvn-golang-wrapper/src/assemble/bundle.xml ================================================ bundle false false jar ${project.build.directory} / *.jar.asc *.jar *.pom *.pom.asc original*.* *.zip ================================================ FILE: mvn-golang-wrapper/src/assemble/distribution.xml ================================================ distr false false tar.gz ${project.basedir} /project target/ texts/ nbactions.xml catalog.xml **/.* /lib ${project.basedir}/target ${project.build.finalName}.jar /lib ${project.basedir} pom.xml / ${basedir}/texts *.* ================================================ FILE: mvn-golang-wrapper/src/main/filtered-resources/META-INF/plexus/components.xml ================================================ org.apache.maven.lifecycle.mapping.LifecycleMapping mvn-golang org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping default com.igormaznitsa:mvn-golang-wrapper:${project.version}:clean com.igormaznitsa:mvn-golang-wrapper:${project.version}:fix com.igormaznitsa:mvn-golang-wrapper:${project.version}:get com.igormaznitsa:mvn-golang-wrapper:${project.version}:generate com.igormaznitsa:mvn-golang-wrapper:${project.version}:fmt com.igormaznitsa:mvn-golang-wrapper:${project.version}:test com.igormaznitsa:mvn-golang-wrapper:${project.version}:build com.igormaznitsa:mvn-golang-wrapper:${project.version}:mvninstall,org.apache.maven.plugins:maven-install-plugin:install com.igormaznitsa:mvn-golang-wrapper:${project.version}:install,org.apache.maven.plugins:maven-deploy-plugin:deploy org.apache.maven.artifact.handler.ArtifactHandler mvn-golang com.igormaznitsa.mvngolang.utils.MvnGolangArtifactHandler mvn-golang false true ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/AbstractGoDependencyAwareMojo.java ================================================ /* * Copyright 2019 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.meta.annotation.MustNotContainNull; import com.igormaznitsa.mvngolang.utils.*; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.filefilter.FileFilterUtils; import org.apache.commons.io.filefilter.TrueFileFilter; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException; import org.zeroturnaround.zip.ZipUtil; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import static com.igormaznitsa.meta.common.utils.Assertions.assertNotNull; public abstract class AbstractGoDependencyAwareMojo extends AbstractGolangMojo { public static final String GO_MOD_FILE_NAME_BAK = ".#go.mod.mvn.orig"; public static final String DELETE_GO_SUM_FLAG_FILE = ".#go.mod.mvn.delete.sum"; /** * Flag shows that sum file should be deleted during build. * Since GoSDK 1.16, work with sum files was changed and they should not be removed anymore because will not be restored automatically. * Also can be reached through 'mvn.golang.delete.sum.file' * * @since 2.3.8 */ @Parameter(name = "deleteSumFile", defaultValue = "false") private boolean deleteSumFile = false; /** * Internal variable to keep GOPATH part containing folders of unpacked * mvn-golang dependencies. * * @since 2.3.0 */ private String extraGoPathSectionInOsFormat = ""; /** * Find artifacts generated by Mvn-Golang among scope dependencies, unpack * them and add unpacked folders into GOPATH during execution. * * @since 2.3.0 */ @Parameter(name = "scanDependencies", defaultValue = "true") private boolean scanDependencies = true; /** * Include test dependencies into scanning process activated if * {@code scanDependencies=true} * * @since 2.3.0 */ @Parameter(name = "includeTestDependencies", defaultValue = "true") private boolean includeTestDependencies = true; /** * Path to the folder where resolved mvn-golang dependency artifacts will be * temporary unpacked and those paths will be added into GOPATH, activated if * {@code scanDependencies=true} * * @since 2.3.0 */ @Parameter(name = "dependencyTempFolder", defaultValue = "${project.build.directory}${file.separator}.__deps__") private String dependencyTempFolder; /** * Flag to turn on session synchronization to prevent parallel processing of * modules in module mode if session is parallel one. Can be defined through property 'mvn.golang.sync.session.if.modules' * * @see #isModuleMode() * @since 2.3.3 */ @Parameter(name = "syncSessionIfModules", defaultValue = "true") private boolean syncSessionIfModules; public boolean isSyncSessionIfModules() { return Boolean.parseBoolean(findMvnProperty("mvn.golang.sync.session.if.modules", Boolean.toString(this.syncSessionIfModules))); } public void setSyncSessionIfModules(final boolean value) { this.syncSessionIfModules = value; } @Nonnull public String getDependencyTempFolder() { return this.dependencyTempFolder; } public boolean isDeleteSumFile() { return Boolean.parseBoolean(findMvnProperty("mvn.golang.delete.sum.file", Boolean.toString(this.deleteSumFile))); } public void setDependencyTempFolder(@Nonnull final String path) { this.dependencyTempFolder = assertNotNull(path); } public boolean isScanDependencies() { return this.scanDependencies; } public void setScanDependencies(final boolean flag) { this.scanDependencies = flag; } public boolean isIncludeTestDependencies() { return this.includeTestDependencies; } public void setIncludeTestDependencies(final boolean value) { this.includeTestDependencies = value; } @Nonnull private String makeRelativePathToFolder(@Nonnull final File goModFile, @Nonnull final File folder) { return goModFile.toPath().relativize(folder.toPath()).toString(); } @Nonnull @MustNotContainNull private List>> findModsInProject() throws IOException { final File sourceFolder = this.getSources(false); if (sourceFolder.isDirectory()) { return findGoModsAndParse(Collections .singletonList(Tuple.of(this.getProject().getArtifact(), sourceFolder))); } else { return Collections.emptyList(); } } private void preprocessModules( @Nonnull @MustNotContainNull final List> unpackedDependencyFolders) throws MojoExecutionException { try { final List>> lst = preprocessModuleFilesInDependencies(unpackedDependencyFolders); final List> dependencyGoMods = listRightPart(lst); final List>> projectGoMods = findModsInProject(); for (final Tuple> f : projectGoMods) { final File goModFile = f.right().right(); final File workingFolder = goModFile.getParentFile(); final File sumFile = new File(workingFolder, GO_SUM_FILE_NAME); final File goModFileBak = new File(workingFolder, GO_MOD_FILE_NAME_BAK); final File deleteSumFileFlag = new File(workingFolder, DELETE_GO_SUM_FLAG_FILE); final boolean deleteSum = this.isDeleteSumFile(); if (deleteSum) { this.getLog().warn("SUM file will be deleted for artifact: " + f.left()); } if (goModFileBak.isFile()) { if (goModFile.isFile() && !goModFile.delete()) { throw new IOException("Can't delete go.mod file: " + goModFile); } if (deleteSum && deleteSumFileFlag.isFile() && sumFile.isFile() && !sumFile.delete()) { throw new IOException("Can't delete file " + sumFile); } FileUtils.copyFile(goModFileBak, goModFile); } else { if (goModFile.isFile()) { FileUtils.copyFile(goModFile, goModFileBak); } if (deleteSum && !sumFile.isFile() && !deleteSumFileFlag.isFile() && !deleteSumFileFlag.createNewFile()) { throw new IOException("Can't create file " + deleteSumFileFlag); } } if (goModFile.isFile()) { final GoMod parsed = GoMod.from(FileUtils.readFileToString(goModFile, StandardCharsets.UTF_8)); if (replaceLinksToModules(Tuple.of(parsed, goModFile), dependencyGoMods)) { FileUtils.write(goModFile, parsed.toString(), StandardCharsets.UTF_8); } if (deleteSum && sumFile.isFile() && !deleteSumFileFlag.isFile() && !deleteSumFileFlag.createNewFile()) { throw new IOException("Can't create file " + deleteSumFileFlag); } } } } catch (IOException ex) { throw new MojoExecutionException("Can't process a go.mod file", ex); } } @Nonnull @MustNotContainNull private List>> findGoModsAndParse( @Nonnull @MustNotContainNull final List> unpackedFolders) throws IOException { final List>> result = new ArrayList<>(); for (final Tuple tuple : unpackedFolders) { for (final File f : FileUtils .listFiles(tuple.right(), FileFilterUtils.nameFileFilter("go.mod"), TrueFileFilter.INSTANCE)) { final GoMod model = GoMod.from(FileUtils.readFileToString(f, StandardCharsets.UTF_8)); result.add(Tuple.of(tuple.left(), Tuple.of(model, f))); } } return result; } private boolean replaceLinksToModules(@Nonnull final Tuple source, @Nonnull @MustNotContainNull final List> targets) throws IOException { boolean changed = false; for (final Tuple j : targets) { if (!source.equals(j)) { final GoMod thatParsedGoMod = j.left(); final File thatGoModFile = j.right(); if (source.left().hasRequireFor(thatParsedGoMod.getModule(), null) && !source.left().hasReplaceFor(thatParsedGoMod.getModule(), null)) { final String relativePath = makeRelativePathToFolder(source.right().getParentFile(), thatGoModFile.getParentFile()); source.left().addItem( new GoMod.GoReplace(new GoMod.ModuleInfo(thatParsedGoMod.getModule()), new GoMod.ModuleInfo(relativePath))); changed = true; } } } return changed; } @Nonnull @MustNotContainNull private List> listRightPart( @Nonnull @MustNotContainNull final List>> list) { final List> parsed = new ArrayList<>(); for (final Tuple> i : list) { parsed.add(i.right()); } return parsed; } private int generateCrossLinksBetweenArtifactGoMods( @Nonnull @MustNotContainNull final List>> unpackedFolders) throws IOException { int changes = 0; final List> parsed = listRightPart(unpackedFolders); for (final Tuple i : parsed) { if (replaceLinksToModules(i, parsed)) { changes++; FileUtils.write(i.right(), i.left().toString(), StandardCharsets.UTF_8); } } return changes; } @Nonnull @MustNotContainNull private List>> preprocessModuleFilesInDependencies( @Nonnull @MustNotContainNull final List> unpackedFolders) throws IOException { getLog().debug("Finding go.mod descriptors in unpacked artifacts"); final List>> foundAndParsedGoMods = findGoModsAndParse(unpackedFolders); getLog().debug(String.format("Found %d go.mod descriptors", foundAndParsedGoMods.size())); final int changedGoModCounter = generateCrossLinksBetweenArtifactGoMods(foundAndParsedGoMods); getLog().debug( String.format("Changed %d go.mod descriptors in unpacked artifacts", changedGoModCounter)); return foundAndParsedGoMods; } @Override public final void doInit() throws MojoFailureException, MojoExecutionException { super.doInit(); if (this.isModuleMode()) { try { final File src = this.getSources(false); this.restoreGoModFromBackupAndRemoveBackup(src); } catch (IOException ex) { throw new MojoExecutionException( "Error during restoring of detected go.mod backup in source folder", ex); } } if (this.isScanDependencies()) { getLog().info("Scanning maven dependencies"); final List> foundArtifacts; try { foundArtifacts = MavenUtils.scanForMvnGoArtifacts( this.getProject(), this.isIgnoreNonResolvableArtifact(), this.isIncludeTestDependencies(), this, this.getSession(), this.getExecution(), this.getArtifactResolver(), this.getRemoteRepositories()); } catch (ArtifactResolverException ex) { throw new MojoFailureException("Can't resolve artifact", ex); } if (foundArtifacts.isEmpty()) { getLog().debug("Mvn golang dependencies are not found"); if (this.isModuleMode()) { this.preprocessModules(Collections.emptyList()); } this.extraGoPathSectionInOsFormat = ""; } else { getLog().debug("Found mvn-golang artifacts: " + foundArtifacts); final File dependencyTempTargetFolder = new File(this.getDependencyTempFolder()); getLog().debug("Dependencies will be unpacked into folder: " + dependencyTempTargetFolder); final List> unpackedFolders = unpackArtifactsIntoFolder(foundArtifacts, dependencyTempTargetFolder); if (this.isModuleMode()) { this.getLog().info("Module mode is activated"); this.preprocessModules(unpackedFolders); this.getLog().info("Dependencies are not added into GOPATH because module mode is on"); } else { final List unpackedFolderList = new ArrayList<>(); for (final Tuple f : unpackedFolders) { unpackedFolderList.add(f.right()); } final String preparedExtraPartForGoPath = IOUtils.makeOsFilePathWithoutDuplications(unpackedFolderList.toArray(new File[0])); getLog().debug("Prepared dependency path for GOPATH: " + preparedExtraPartForGoPath); this.extraGoPathSectionInOsFormat = preparedExtraPartForGoPath; } } } else { getLog().info("Maven dependency scanning is off"); } } public boolean isIgnoreNonResolvableArtifact() { return false; } private void restoreGoModFromBackupAndRemoveBackup(@Nonnull final File folder) throws IOException { final Collection backupFiles = FileUtils .listFiles(folder, FileFilterUtils.nameFileFilter(GO_MOD_FILE_NAME_BAK), TrueFileFilter.INSTANCE); this.getLog().debug(String .format("Restoring go.mod from backup in %s, detected %d files", folder, backupFiles.size())); for (final File backup : backupFiles) { final File workingFolder = backup.getParentFile(); final File restored = new File(workingFolder, GO_MOD_FILE_NAME); final File goSumFile = new File(workingFolder, GO_SUM_FILE_NAME); final File deleteGoSumFileFlag = new File(workingFolder, DELETE_GO_SUM_FLAG_FILE); if (restored.isFile() && !restored.delete()) { throw new IOException("Can't delete file during backup restore: " + restored); } if (!backup.renameTo(restored)) { throw new IOException("Can't rename backup: " + backup + " -> " + restored); } if (this.isDeleteSumFile()) { if (deleteGoSumFileFlag.isFile()) { if (!deleteGoSumFileFlag.delete()) { throw new IOException("Can't delete file " + deleteGoSumFileFlag); } if (goSumFile.isFile() && !goSumFile.delete()) { throw new IOException("Can't delete file " + goSumFile); } } } } } @Override public void afterExecution(@Nullable final ProxySettings proxySettings, final boolean error) throws MojoFailureException, MojoExecutionException { try { if (this.isModuleMode()) { this.getLog().debug("module mode is on"); final File srcFolder = this.getSources(false); this.getLog().debug("Detected source folder: " + srcFolder); if (srcFolder.isDirectory()) { if (this.isRestoreGoMod()) { this.getLog().debug("Restoring go.mod from backup in source folder: " + srcFolder); this.restoreGoModFromBackupAndRemoveBackup(srcFolder); } else { this.getLog().debug("Restoring of go.mod from backup is disabled by project property"); } } else { this.getLog() .debug("Restore backup mod files is ignored because source folder is not directory"); } } else { this.getLog().debug("module mode is off"); } } catch (IOException ex) { throw new MojoExecutionException("Error during restore go.mod from backup", ex); } finally { super.afterExecution(proxySettings, error); } } @Override protected boolean doesNeedSessionLock() { return this.getSession().isParallel() && this.isModuleMode() && this.isSyncSessionIfModules(); } protected boolean isRestoreGoMod() { return Boolean.parseBoolean(MavenUtils .findProperty(this.getSession(), this.getProject(), "mvn.golang.restore.go.mod", "true")); } @Nonnull @MustNotContainNull private List> unpackArtifactsIntoFolder(@Nonnull @MustNotContainNull final List> zippedArtifacts, @Nonnull final File targetFolder) throws MojoExecutionException { final List> resultFolders = new ArrayList<>(); if (!targetFolder.isDirectory() && !targetFolder.mkdirs()) { throw new MojoExecutionException( "Can't create folder to unpack dependencies: " + targetFolder); } for (final Tuple zipFile : zippedArtifacts) { if (this.isVerbose()) { this.getLog().info("mvn-golang dependency: " + zipFile.left()); } final File outDir = new File(targetFolder, FilenameUtils.getBaseName(zipFile.right().getName())); final boolean doUnpackArch; if (outDir.isDirectory()) { this.getLog().debug("Unpacked dependency folder already exists: " + outDir); if (Boolean.parseBoolean(MavenUtils .findProperty(this.getSession(), this.getProject(), "mvn.golang.force.clean.dependency", "false"))) { this.getLog().debug("Forcing dependency folder delete: " + outDir); try { FileUtils.deleteDirectory(outDir); } catch (IOException ex) { throw new MojoExecutionException("Can't delete dependency folder: " + outDir, ex); } doUnpackArch = true; } else { getLog().debug("Ignoring dependency unpack because folder exists: " + outDir); doUnpackArch = false; } } else { doUnpackArch = true; } if (doUnpackArch) { if (ZipUtil .containsEntry(zipFile.right(), GolangMvnInstallMojo.MVNGOLANG_BUILD_FOLDERS_FILE)) { final File srcTargetFolder = new File(outDir, "src"); try { unzipSrcFoldersContent(zipFile.right(), srcTargetFolder); } catch (Exception ex) { throw new MojoExecutionException( "Can't unpack source folders from dependency archive '" + zipFile.right().getName() + "' into folder '" + srcTargetFolder + '\'', ex); } } else { try { getLog().debug("Unpack dependency archive: " + zipFile); ZipUtil.unpack(zipFile.right(), outDir, StandardCharsets.UTF_8); } catch (Exception ex) { throw new MojoExecutionException( "Can't unpack dependency archive '" + zipFile.right().getName() + "' into folder '" + targetFolder + '\'', ex); } } } resultFolders.add(Tuple.of(zipFile.left(), outDir)); } return resultFolders; } private boolean unzipSrcFoldersContent(@Nonnull final File artifactZip, @Nonnull final File targetFolder) { final byte[] buildFolderListFile = ZipUtil.unpackEntry(artifactZip, GolangMvnInstallMojo.MVNGOLANG_BUILD_FOLDERS_FILE); if (buildFolderListFile == null) { return false; } else { final List folderList = new ArrayList<>(); for (final String folder : new String(buildFolderListFile, StandardCharsets.UTF_8) .split("\\n")) { final String trimmed = folder.trim(); if (trimmed.isEmpty()) { continue; } folderList.add(folder + '/'); } for (final String folder : folderList) { ZipUtil.unpack(artifactZip, targetFolder, (@Nonnull final String name) -> { if (name.startsWith(folder)) { return name.substring(folder.length()); } return null; }); } return true; } } @Nonnull @Override protected final String getSpecialPartOfGoPath() { return this.extraGoPathSectionInOsFormat; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/AbstractGoPackageAndDependencyAwareMojo.java ================================================ /* * Copyright 2019 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.meta.annotation.MustNotContainNull; import com.igormaznitsa.meta.common.utils.ArrayUtils; import com.igormaznitsa.meta.common.utils.GetUtils; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.maven.plugins.annotations.Parameter; public abstract class AbstractGoPackageAndDependencyAwareMojo extends AbstractGoDependencyAwareMojo { /** * List of packages. */ @Parameter(name = "packages") private String[] packages; @Nullable @MustNotContainNull protected String[] getDefaultPackages() { return null; } @Nullable @MustNotContainNull public String[] getPackages() { return this.packages == null ? this.getDefaultPackages() : this.packages.clone(); } public void setPackages(@Nullable @MustNotContainNull final String[] value) { this.packages = value; } @Override @Nonnull @MustNotContainNull public String[] getTailArguments() { return GetUtils.ensureNonNull(getPackages(), ArrayUtils.EMPTY_STRING_ARRAY); } @Override @Nonnull @MustNotContainNull public String[] getCommandFlags() { return ArrayUtils.EMPTY_STRING_ARRAY; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/AbstractGoPackageAwareMojo.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.meta.annotation.MustNotContainNull; import com.igormaznitsa.meta.common.utils.ArrayUtils; import com.igormaznitsa.meta.common.utils.GetUtils; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.maven.plugins.annotations.Parameter; public abstract class AbstractGoPackageAwareMojo extends AbstractGolangMojo { /** * List of packages. */ @Parameter(name = "packages") private String[] packages; @Nullable @MustNotContainNull protected String[] getDefaultPackages() { return null; } @Nullable @MustNotContainNull public String[] getPackages() { return this.packages == null ? this.getDefaultPackages() : this.packages.clone(); } public void setPackages(@Nullable @MustNotContainNull final String[] value) { this.packages = value; } @Override @Nonnull @MustNotContainNull public String[] getTailArguments() { return GetUtils.ensureNonNull(getPackages(), ArrayUtils.EMPTY_STRING_ARRAY); } @Override @Nonnull @MustNotContainNull public String[] getCommandFlags() { return ArrayUtils.EMPTY_STRING_ARRAY; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/AbstractGolangMojo.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import static com.igormaznitsa.meta.common.utils.Assertions.assertNotNull; import static com.igormaznitsa.mvngolang.utils.MavenUtils.findProperty; import com.igormaznitsa.meta.annotation.LazyInited; import com.igormaznitsa.meta.annotation.MayContainNull; import com.igormaznitsa.meta.annotation.MustNotContainNull; import com.igormaznitsa.meta.annotation.ReturnsOriginal; import com.igormaznitsa.meta.common.utils.ArrayUtils; import com.igormaznitsa.meta.common.utils.GetUtils; import com.igormaznitsa.meta.common.utils.StrUtils; import com.igormaznitsa.mvngolang.utils.IOUtils; import com.igormaznitsa.mvngolang.utils.ProxySettings; import com.igormaznitsa.mvngolang.utils.SysUtils; import com.igormaznitsa.mvngolang.utils.UnpackUtils; import com.igormaznitsa.mvngolang.utils.WildCardMatcher; import com.igormaznitsa.mvngolang.utils.XGoogHashHeader; import java.io.BufferedOutputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.StringReader; import java.net.InetAddress; import java.net.URLEncoder; import java.net.UnknownHostException; import java.nio.charset.Charset; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.concurrent.locks.ReentrantLock; import java.util.regex.Pattern; import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.filefilter.FileFilterUtils; import org.apache.commons.io.filefilter.TrueFileFilter; import org.apache.commons.lang3.SystemUtils; import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.HttpException; import org.apache.http.HttpHost; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.StatusLine; import org.apache.http.auth.AuthScope; import org.apache.http.auth.NTCredentials; import org.apache.http.client.CredentialsProvider; import org.apache.http.client.HttpClient; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.HttpGet; import org.apache.http.config.Registry; import org.apache.http.config.RegistryBuilder; import org.apache.http.conn.routing.HttpRoute; import org.apache.http.conn.routing.HttpRoutePlanner; import org.apache.http.conn.socket.ConnectionSocketFactory; import org.apache.http.conn.socket.PlainConnectionSocketFactory; import org.apache.http.conn.ssl.NoopHostnameVerifier; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.BasicHttpClientConnectionManager; import org.apache.http.impl.conn.DefaultProxyRoutePlanner; import org.apache.http.protocol.HttpContext; import org.apache.http.util.EntityUtils; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecution; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import org.apache.maven.settings.Proxy; import org.apache.maven.settings.Settings; import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.zeroturnaround.exec.ProcessExecutor; import org.zeroturnaround.exec.ProcessResult; public abstract class AbstractGolangMojo extends AbstractMojo { public static final String GOARTIFACT_PACKAGING = "mvn-golang"; public static final String GO_MOD_FILE_NAME = "go.mod"; public static final String GO_SUM_FILE_NAME = "go.sum"; public static final String ENV_GO111MODULE = "GO111MODULE"; /** * VERSION, OS, PLATFORM,-OSXVERSION */ public static final String NAME_PATTERN = "go%s.%s-%s%s"; private static final List ALLOWED_SDKARCHIVE_CONTENT_TYPE = Collections.unmodifiableList( Arrays.asList("application/octet-stream", "application/zip", "application/x-tar", "application/x-gzip")); private static final ReentrantLock LOCKER = new ReentrantLock(); private static final String[] BANNER = new String[] {"______ ___ _________ ______", "___ |/ /__ __________ ____/________ / ______ ______________ _", "__ /|_/ /__ | / /_ __ \\ / __ _ __ \\_ / _ __ `/_ __ \\_ __ `/", "_ / / / __ |/ /_ / / / /_/ / / /_/ / /___/ /_/ /_ / / / /_/ / ", "/_/ /_/ _____/ /_/ /_/\\____/ \\____//_____/\\__,_/ /_/ /_/_\\__, /", " /____/", " https://github.com/raydac/mvn-golang", "" }; private static final Pattern GOBINFOLDER_PATTERN = Pattern .compile("(?:\\\\|/)go[0-9\\-\\+.]*(?:\\\\|/)bin(?:\\\\|/)?$", Pattern.CASE_INSENSITIVE); /** * set of flags to be ignored among build and extra build flags, for inside * use */ protected final Set buildFlagsToIgnore = new HashSet<>(); protected final List tempBuildFlags = new ArrayList<>(); @Parameter(defaultValue = "${settings}", readonly = true) protected Settings settings; @Component private ArtifactResolver artifactResolver; @Parameter(defaultValue = "${project.remoteArtifactRepositories}", readonly = true, required = true) private List remoteRepositories; @Parameter(defaultValue = "${project}", readonly = true, required = true) private MavenProject project; @Parameter(defaultValue = "${session}", readonly = true, required = true) private MavenSession session; @Parameter(defaultValue = "${mojoExecution}", readonly = true, required = true) private MojoExecution execution; /** * Flag to turn on support for module mode. Dependencies will not be added * into GOPATH, go.mod files will be preprocessed to have replace links to * each other locally. After processing all go.mod files are restored from * backup. Can be overridden by property "mvn.golang.module.mode" * * @since 2.3.3 */ @Parameter(name = "moduleMode", defaultValue = "false") private boolean moduleMode; /** * Path to be used as working directory for executing process, by default it * is unset and working directory depends on mode and command. * * @since 2.3.3 */ @Parameter(name = "workingDir") private String workingDir; /** * Flag shows that environment PATH variable should be filtered for footsteps * of other go/bin folders to prevent conflicts. * * @since 2.3.0 */ @Parameter(defaultValue = "true", name = "filterEnvPath") private boolean filterEnvPath = true; /** * Check hash for downloaded SDK archive. * * @since 2.3.0 */ @Parameter(name = "checkSdkHash", defaultValue = "true") private boolean checkSdkHash = true; /** * Use proxy server defined for maven. * * @since 2.3.0 */ @Parameter(name = "useMavenProxy", defaultValue = "true") private boolean useMavenProxy; /** * Disable check of SSL certificate during HTTPS request. Also can be changed * by system property 'mvn.golang.disable.ssl.check' * * @since 2.1.7 */ @Parameter(name = "disableSSLcheck", defaultValue = "false") private boolean disableSSLcheck; /** * Suppose SDK archive file name if it is not presented in the list loaded * from server. * * @since 2.1.6 */ @Parameter(name = "supposeSdkArchiveFileName", defaultValue = "true") private boolean supposeSdkArchiveFileName; /** * Parameters of proxy server to be used to make connection to SDK server. * * @since 2.1.1 */ @Parameter(name = "proxy") private ProxySettings proxy; /** * Skip execution of the mojo. Also can be disabled through system property * `mvn.golang.skip' * * @since 2.1.2 */ @Parameter(name = "skip", defaultValue = "false") private boolean skip; /** * Ignore error exit code returned by GoLang tool and don't generate any * failure. * * @since 2.1.1 */ @Parameter(name = "ignoreErrorExitCode", defaultValue = "false") private boolean ignoreErrorExitCode; /** * Folder to place console logs. * * @since 2.1.1 */ @Parameter(name = "reportsFolder", defaultValue = "${project.build.directory}${file.separator}reports") private String reportsFolder; /** * File to save console out log. If empty then will not be saved. * * @since 2.1.1 */ @Parameter(name = "outLogFile") private String outLogFile; /** * File to save console error log. If empty then will not be saved * * @since 2.1.1 */ @Parameter(name = "errLogFile") private String errLogFile; /** * Base site for SDK download. By default it uses * https://storage.googleapis.com/golang/ */ @Parameter(name = "sdkSite", defaultValue = "https://storage.googleapis.com/golang/") private String sdkSite; /** * Hide ASC banner. */ @Parameter(defaultValue = "true", name = "hideBanner") private boolean hideBanner; /** * Folder to be used to save and unpack loaded SDKs and also keep different * info. By default it has value "${user.home}${file.separator}.mvnGoLang" */ @Parameter(defaultValue = "${user.home}${file.separator}.mvnGoLang", name = "storeFolder") private String storeFolder; /** * Folder to be used as $GOPATH. NB! By default it has value * "${user.home}${file.separator}.mvnGoLang${file.separator}.go_path" */ @Parameter(defaultValue = "${user.home}${file.separator}.mvnGoLang${file.separator}.go_path", name = "goPath") private String goPath; /** * Value to be provided as $GO386. This controls the code generated by gc to * use either the 387 floating-point unit (set to 387) or SSE2 instructions * (set to sse2) for floating point computations. * * @since 2.1.7 */ private String target386; /** * Value to be provided as $GOARM. This sets the ARM floating point * co-processor architecture version the run-time should target. If you are * compiling on the target system, its value will be auto-detected. * * @since 2.1.1 */ @Parameter(name = "targetArm") private String targetArm; /** * Folder to be used as $GOBIN. NB! By default it has value * "${project.build.directory}". It is possible to disable usage of GOBIN in * process through value NONE */ @Parameter(defaultValue = "${project.build.directory}", name = "goBin") private String goBin; /** * The Go SDK version. It plays role if goRoot is undefined. Can be defined * through system property 'mvn.golang.go.version' */ @Parameter(name = "goVersion", defaultValue = "1.21.7") private String goVersion; /** * Cache directory to keep build data. It affects GOCACHE environment * variable. By default it is turned off by value `off` * * @since 2.3.1 */ @Parameter(name = "goCache", defaultValue = "${project.build.directory}${file.separator}.goBuildCache") private String goCache; /** * The Go home folder. It can be undefined and in the case the plug-in will * make automatic business to find SDK in its cache or download it. */ @Parameter(name = "goRoot") private String goRoot; /** * The Go bootstrap home folder. */ @Parameter(name = "goRootBootstrap") private String goRootBootstrap; /** * Make GOPATH value as the last one in new generated GOPATH chain. * * @since 2.1.3 */ @Parameter(name = "enforceGoPathToEnd", defaultValue = "false") private boolean enforceGoPathToEnd; /** * Sub-path to executing go tool in SDK folder. * * @since 1.1.0 */ @Parameter(name = "execSubpath", defaultValue = "bin") private String execSubpath; /** * Go tool to be executed. NB! An Extension for OS will be automatically * added. * * @since 1.1.0 */ @Parameter(name = "exec", defaultValue = "go") private String exec; /** * Allows defined text to be printed before execution as warning in to log. */ @Parameter(name = "echoWarn") private String[] echoWarn; /** * Allows defined text to be printed before execution as info into log. */ @Parameter(name = "echo") private String[] echo; /** * Disable loading GoLang SDK through network if it is not found at cache. */ @Parameter(name = "disableSdkLoad", defaultValue = "false") private boolean disableSdkLoad; /** * GoLang source directory. By default ${project.build.sourceDirectory} */ @Parameter(defaultValue = "${project.build.sourceDirectory}", name = "sources") private String sources; /** * The Target OS. */ @Parameter(name = "targetOs") private String targetOs; /** * The OS. If it is not defined then plug-in will try figure out the current * one. */ @Parameter(name = "os") private String os; /** * The Target architecture. */ @Parameter(name = "targetArch") private String targetArch; /** * The Architecture. If it is not defined then plug-in will try figure out the * current one. */ @Parameter(name = "arch") private String arch; /** * Version of OSX to be used during distributive name synthesis. */ @Parameter(name = "osxVersion") private String osxVersion; /** * List of optional build flags. */ @Parameter(name = "buildFlags") private String[] buildFlags; /** * Be verbose in logging. */ @Parameter(name = "verbose", defaultValue = "false") private boolean verbose; /** * Do not delete SDK archive after unpacking. */ @Parameter(name = "keepSdkArchive", defaultValue = "false") private boolean keepSdkArchive; /** * Name of tool to be called instead of standard 'go' tool. */ @Parameter(name = "useGoTool") private String useGoTool; /** * Flag to override all provided configuration variables by their environment * values if such value is detected *
    *
  • goRoot by $GOROOT
  • *
  • goRootBootstrap by $GOROOT_BOOTSTRAP
  • *
  • targetOs by $GOOS
  • *
  • targetArch by $GOARCH
  • *
  • targetArm by $GOARM
  • *
  • goPath by $GOPATH
  • *
* NB! Your configuration values will be ignored if you define the flag * because it has higher priority! */ @Parameter(name = "useEnvVars", defaultValue = "false") private boolean useEnvVars; /** * It allows to define key value pairs which will be used as environment * variables for started GoLang process. */ @Parameter(name = "env") private Map env; /** * Allows directly define name of SDK archive. If it is not defined then * plug-in will try to generate name and find such one in downloaded SDK * list.. */ @Parameter(name = "sdkArchiveName") private String sdkArchiveName; /** * Directly defined URL to download GoSDK. In the case SDK list will not be * downloaded and plug-in will try download archive through the link. */ @Parameter(name = "sdkDownloadUrl") private String sdkDownloadUrl; /** * Timeout for HTTP connection in milliseconds. * * @since 2.3.0 */ @Parameter(name = "connectionTimeout", defaultValue = "60000") private int connectionTimeout = 60000; /** * Keep unpacked wrongly SDK folder. */ @Parameter(name = "keepUnarchFolderIfError", defaultValue = "false") private boolean keepUnarchFolderIfError; /** * Allows to define folders which will be added into $GOPATH * * @since 2.0.0 */ @Parameter(name = "addToGoPath") private String[] addToGoPath; @LazyInited private CloseableHttpClient httpClient; @LazyInited private ByteArrayOutputStream consoleErrBuffer; @LazyInited private ByteArrayOutputStream consoleOutBuffer; @Nonnull private static String ensureNoSurroundingSlashes(@Nonnull final String str) { String result = str; if (!result.isEmpty() && (result.charAt(0) == '/' || result.charAt(0) == '\\')) { result = result.substring(1); } if (!result.isEmpty() && (result.charAt(result.length() - 1) == '/' || result.charAt(result.length() - 1) == '\\')) { result = result.substring(0, result.length() - 1); } return result; } private static void deleteFileIfExists(@Nonnull final File file) throws IOException { if (file.isFile() && !file.delete()) { throw new IOException("Can't delete file : " + file); } } private static boolean isSafeEmpty(@Nullable final String value) { return value == null || value.isEmpty(); } @Nonnull private static String extractExtensionOfArchive(@Nonnull final String archiveName) { final String lcName = archiveName.toLowerCase(Locale.ENGLISH); final String result; if (lcName.endsWith(".tar.gz")) { result = archiveName.substring(archiveName.length() - "tar.gz".length()); } else { result = FilenameUtils.getExtension(archiveName); } return result; } @Nonnull protected static String adaptExecNameForOS(@Nonnull final String execName) { return execName + (SystemUtils.IS_OS_WINDOWS ? ".exe" : ""); } @Nonnull private static String getPathToFolder(@Nonnull final String path) { String text = path; if (!text.endsWith("/") && !text.endsWith("\\")) { text = text + File.separatorChar; } return text; } @Nonnull private static String getPathToFolder(@Nonnull final File path) { return getPathToFolder(path.getAbsolutePath()); } @Nullable protected static File findExisting(@Nonnull @MayContainNull final File... files) { File result = null; for (final File f : files) { if (f != null && f.isFile()) { result = f; break; } } return result; } @Nonnull private static String removeSrcFolderAtEndIfPresented(@Nonnull final String text) { String result = text; if (text.endsWith("/src") || text.endsWith("\\src")) { result = text.substring(0, text.length() - 4); } return result; } @Nonnull private static String extractComputerName() { String result = System.getenv("COMPUTERNAME"); if (result == null) { result = System.getenv("HOSTNAME"); } if (result == null) { try { result = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException ex) { // do nothing, let be null } } return GetUtils.ensureNonNull(result, ""); } @Nonnull private static String extractDomainName() { final String result = System.getenv("USERDOMAIN"); return GetUtils.ensureNonNull(result, ""); } private static boolean tryRenameFolder(@Nonnull final File sourceFolder, @Nonnull final File targetFolder, final int attempts, final long retryDelayMs) { boolean result = false; for (int i = 0; i < attempts && !result; i++) { result = sourceFolder.renameTo(targetFolder); if (!result && i < attempts - 1) { try { Thread.sleep(retryDelayMs); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); return false; } } } return result; } @Nullable private static String nullIfBlank(@Nullable final String text) { return text == null || text.trim().isEmpty() ? null : text; } @Nullable public final String getWorkingDir() { return this.workingDir; } public final void setWorkingDir(@Nullable final String path) { this.workingDir = path; } public boolean isModuleMode() { return Boolean .parseBoolean(findMvnProperty("mvn.golang.module.mode", Boolean.toString(this.moduleMode))); } public void setModuleMode(final boolean value) { this.moduleMode = value; } @Nonnull public ArtifactResolver getArtifactResolver() { return assertNotNull("Artifact resolver component is not provided by Maven", this.artifactResolver); } @Nonnull @MustNotContainNull public List getRemoteRepositories() { return this.remoteRepositories; } protected boolean doesNeedSessionLock() { return false; } /** * Generate unique file name in bounds current maven session. * * @return file name, must not be null * @since 2.3.3 */ @Nonnull private String makeSessionLockFileName() { final String id = Long.toHexString(this.getSession().getStartTime().getTime()).toUpperCase(Locale.ENGLISH); return ".#mvn.go.session.lock." + id; } @Nonnull protected File getTempFileFolder() { return new File(System.getProperty("java.io.tmpdir")); } /** * Internal method to generate session locking file for mvn-golang mojo. If * file exists then it will be waiting for its removing to create new one. * * @throws MojoExecutionException it will be thrown if any error in process * @since 2.3.3 */ private void lockMvnGolangSession() throws MojoExecutionException { final File lockFile = new File(this.getTempFileFolder(), makeSessionLockFileName()); this.getLog().debug("Locking project for mvn-golang sync processing, locker file: " + lockFile); while (!Thread.currentThread().isInterrupted()) { final boolean locked; try { locked = lockFile.createNewFile(); } catch (IOException ex) { throw new MojoExecutionException( "Detected error during attempt to make locker file: " + lockFile, ex); } if (locked) { lockFile.deleteOnExit(); this.getLog().debug("Locking file created: " + lockFile); return; } else { try { Thread.sleep(100); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); break; } } } } /** * Internal method to unlock current mvn-golang session through removing of * the locking file. If file can't be found then it warns and continue work as * if it would be removed. * * @throws MojoExecutionException it is thrown if any error * @since 2.3.3 */ private void unlockMvnGolangSession() throws MojoExecutionException { final File locker = new File(this.getTempFileFolder(), makeSessionLockFileName()); this.getLog().debug("Unlocking project for mvn-golang sync processing, locker file: " + locker); if (locker.isFile()) { if (!locker.delete()) { throw new MojoExecutionException("Can't delete locker file: " + locker); } } else { this.getLog().warn("Can't detect locker file, may be it was removed externally: " + locker); } } @Nonnull private File loadSDKAndUnpackIntoCache( @Nullable final ProxySettings proxySettings, @Nonnull final File cacheFolder, @Nonnull final String baseSdkName, final boolean notLoadIfNotInCache ) throws IOException, MojoExecutionException { synchronized (AbstractGolangMojo.class) { final File sdkFolder = new File(cacheFolder, baseSdkName); if (sdkFolder.isDirectory()) { return sdkFolder; } final File lockFile = new File(cacheFolder, ".lck" + baseSdkName); lockFile.deleteOnExit(); try { if (!lockFile.createNewFile()) { this.getLog().info("Detected SDK loading, waiting for the process end"); while (lockFile.exists()) { try { Thread.sleep(100L); } catch (InterruptedException ex) { throw new IOException("Wait of SDK loading is interrupted", ex); } } this.getLog().info("Loading process has been completed"); return sdkFolder; } if (sdkFolder.isDirectory()) { if (this.isVerbose() || this.getLog().isDebugEnabled()) { this.getLog().info("SDK cache folder : " + sdkFolder); } return sdkFolder; } else if (notLoadIfNotInCache || this.session.isOffline()) { this.getLog().error( "Can't find cached Golang SDK and downloading is disabled or Maven in offline mode"); throw new IOException( "Can't find " + baseSdkName + " in the cache but loading is directly disabled"); } final String predefinedLink = this.getSdkDownloadUrl(); final File archiveFile; final String linkForDownloading; if (isSafeEmpty(predefinedLink)) { this.logOptionally("There is not any predefined SDK URL"); final String sdkFileName = this.findSdkArchiveFileName(proxySettings, baseSdkName); archiveFile = new File(cacheFolder, sdkFileName); linkForDownloading = this.getSdkSite() + sdkFileName; } else { final String extension = extractExtensionOfArchive(assertNotNull(predefinedLink)); archiveFile = new File(cacheFolder, baseSdkName + '.' + extension); linkForDownloading = predefinedLink; this.logOptionally("Using predefined URL to download SDK : " + linkForDownloading); this.logOptionally("Detected extension of archive : " + extension); } if (archiveFile.exists()) { this.logOptionally( "Detected existing archive " + archiveFile + ", deleting it and reload"); if (!archiveFile.delete()) { throw new IOException("Can't delete archive file: " + archiveFile); } } final HttpGet methodGet = new HttpGet(linkForDownloading); final RequestConfig config = this.processRequestConfig(proxySettings, this.getConnectionTimeout(), RequestConfig.custom()).build(); methodGet.setConfig(config); boolean errorsDuringLoading = true; boolean showProgressBar; try { if (!archiveFile.isFile()) { this.getLog().warn("Loading SDK archive with URL : " + linkForDownloading); final HttpResponse response = this.getHttpClient(proxySettings).execute(methodGet); final StatusLine statusLine = response.getStatusLine(); this.getLog().debug("HttpResponse: " + response); if (statusLine.getStatusCode() != HttpStatus.SC_OK) { throw new IOException(String .format("Can't load SDK archive from %s : %d %s", linkForDownloading, statusLine.getStatusCode(), statusLine.getReasonPhrase())); } final XGoogHashHeader xGoogHash = new XGoogHashHeader(response.getHeaders("x-goog-hash")); this.getLog().debug("XGoogHashHeader: " + xGoogHash); final HttpEntity entity = response.getEntity(); final Header contentType = entity.getContentType(); if (!ALLOWED_SDKARCHIVE_CONTENT_TYPE.contains(contentType.getValue())) { throw new IOException("Unsupported content type : " + contentType.getValue()); } final long size = entity.getContentLength(); try (final InputStream inStream = entity.getContent()) { showProgressBar = size > 0L && !this.session.isParallel(); this.getLog().info("Downloading SDK archive into file : " + archiveFile); long loadedCounter = 0L; final byte[] buffer = new byte[1024 * 1024]; int lastRenderedValue = -1; final int PROGRESSBAR_WIDTH = 10; final String LOADING_TITLE = "Loading " + size / (1024L * 1024L) + " Mb "; if (showProgressBar) { lastRenderedValue = IOUtils .printTextProgressBar(LOADING_TITLE, 0, size, PROGRESSBAR_WIDTH, lastRenderedValue); } final OutputStream fileOutStream = new BufferedOutputStream(new FileOutputStream(archiveFile), 128 * 16384); try { while (!Thread.currentThread().isInterrupted()) { final int readCounter = inStream.read(buffer); if (readCounter < 0) { break; } fileOutStream.write(buffer, 0, readCounter); loadedCounter += readCounter; if (showProgressBar) { lastRenderedValue = IOUtils .printTextProgressBar(LOADING_TITLE, loadedCounter, size, PROGRESSBAR_WIDTH, lastRenderedValue); } } } finally { if (showProgressBar) { System.out.println(); } IOUtils.closeSilently(fileOutStream); } if (Thread.currentThread().isInterrupted()) { throw new MojoExecutionException("Interrupted"); } this.getLog().info("Archived SDK has been succesfully downloaded, its size is " + (archiveFile.length() / 1024L) + " Kb"); } if (this.isCheckSdkHash()) { if (xGoogHash.isValid() && xGoogHash.hasData()) { this.getLog().debug("Checking hash of file"); final boolean fileHashOk = xGoogHash.isFileOk(this.getLog(), archiveFile); if (fileHashOk) { this.getLog().info("Downloaded archive file hash is OK"); } else { this.getLog().error("Downloaded archive file hash is BAD"); throw new MojoExecutionException("Downloaded SDK archive has wrong hash"); } } else { if (!xGoogHash.isValid()) { throw new MojoExecutionException( "Couldn't parse x-goog-hash from response: " + response); } else { throw new MojoExecutionException( "Parsed x-goog-hash doesn't contain data but marked as valid one: " + xGoogHash); } } } } else { this.getLog().info("Archive file of SDK has been found in the cache : " + archiveFile); } errorsDuringLoading = false; final File interFolder = this.unpackArchToFolder(archiveFile, "go", new File(cacheFolder, ".#" + baseSdkName)); this.getLog().info("Renaming " + interFolder.getName() + " to " + sdkFolder.getName()); if (tryRenameFolder(interFolder, sdkFolder, 3, 5000L)) { this.logOptionally("Renamed successfully: " + interFolder + " -> " + sdkFolder); } else { throw new IOException( "Can't rename temp GoSDK folder: " + interFolder + " -> " + sdkFolder); } return sdkFolder; } finally { methodGet.releaseConnection(); if (errorsDuringLoading || !this.isKeepSdkArchive()) { this.logOptionally("Deleting archive : " + archiveFile + (errorsDuringLoading ? " (because error during loading)" : "")); deleteFileIfExists(archiveFile); } else { this.logOptionally("Archive file is kept for special flag : " + archiveFile); } } } finally { final boolean deleted = FileUtils.deleteQuietly(lockFile); this.getLog().debug("Lock file " + lockFile + " deleted : " + deleted); } } } public boolean isFilterEnvPath() { return this.filterEnvPath; } @Nullable protected String findMvnProperty(@Nonnull final String key, @Nullable final String dflt) { if (this.session == null || this.project == null) { return null; } return findProperty(this.session, this.project, key, dflt); } public boolean isSkip() { final boolean result = Boolean.parseBoolean(findMvnProperty("mvn.golang.skip", Boolean.toString(this.skip))); final String skipMojoSuffix = this.getSkipMojoPropertySuffix(); return skipMojoSuffix == null ? result : result || Boolean.parseBoolean( findMvnProperty(String.format("mvn.golang.%s.skip", skipMojoSuffix), "false")); } public boolean isEnforceGoPathToEnd() { return this.enforceGoPathToEnd; } @Nonnull public MavenProject getProject() { return this.project; } @Nonnull public MojoExecution getExecution() { return this.execution; } @Nonnull public MavenSession getSession() { return this.session; } public boolean isIgnoreErrorExitCode() { return this.ignoreErrorExitCode; } @Nonnull public Map getEnv() { return GetUtils.ensureNonNull(this.env, Collections.EMPTY_MAP); } @Nullable public String getSdkDownloadUrl() { return this.sdkDownloadUrl; } @Nonnull public String getExecSubpath() { return ensureNoSurroundingSlashes(assertNotNull(this.execSubpath)); } public int getConnectionTimeout() { return this.connectionTimeout; } @Nonnull public String getExec() { return ensureNoSurroundingSlashes(assertNotNull(this.exec)); } public boolean isUseEnvVars() { return this.useEnvVars; } public boolean isKeepSdkArchive() { return this.keepSdkArchive; } public boolean isKeepUnarchFolderIfError() { return this.keepUnarchFolderIfError; } @Nullable public String getSdkArchiveName() { return this.sdkArchiveName; } @Nonnull public String getReportsFolder() { return this.reportsFolder; } @Nullable public String getOutLogFile() { return this.outLogFile; } @Nullable public String getErrLogFile() { return this.errLogFile; } public boolean isCheckSdkHash() { return this.checkSdkHash; } @Nonnull public String getStoreFolder() { return this.storeFolder; } @Nullable public String getUseGoTool() { return this.useGoTool; } public boolean isVerbose() { return Boolean .parseBoolean(findMvnProperty("mvn.golang.verbose", Boolean.toString(this.verbose))); } public boolean isDisableSdkLoad() { return this.disableSdkLoad; } @Nonnull public String getSdkSite() { return assertNotNull(this.sdkSite); } @Nonnull @MustNotContainNull public String[] getBuildFlags() { final List result = new ArrayList<>(); for (final String s : ArrayUtils .joinArrays(GetUtils.ensureNonNull(this.buildFlags, ArrayUtils.EMPTY_STRING_ARRAY), getExtraBuildFlags())) { if (!this.buildFlagsToIgnore.contains(s)) { result.add(s); } } result.addAll(this.tempBuildFlags); return result.toArray(new String[0]); } @Nonnull @MustNotContainNull protected String[] getExtraBuildFlags() { return ArrayUtils.EMPTY_STRING_ARRAY; } @Nonnull @MustNotContainNull public File[] findGoPath(final boolean ensureExist) throws IOException { LOCKER.lock(); try { final String foundGoPath = getGoPath(); if (getLog().isDebugEnabled()) { getLog().debug("findGoPath(" + ensureExist + "), getGoPath() returns " + foundGoPath); } final List result = new ArrayList<>(); for (final String p : foundGoPath.split(String.format("\\%s", File.pathSeparator))) { final File folder = new File(p); result.add(folder); if (ensureExist && !folder.isDirectory() && !folder.mkdirs()) { throw new IOException("Can't create folder for GOPATH : " + folder.getAbsolutePath()); } } return result.toArray(new File[0]); } finally { LOCKER.unlock(); } } @Nullable public File findGoRootBootstrap(final boolean ensureExist) throws IOException { LOCKER.lock(); try { final String value = getGoRootBootstrap(); File result = null; if (value != null) { result = new File(value); if (ensureExist && !result.isDirectory()) { throw new IOException("Can't find folder for GOROOT_BOOTSTRAP: " + result); } } return result; } finally { LOCKER.unlock(); } } @Nonnull public String getOs() { String result = this.os; if (isSafeEmpty(result)) { if (isSafeEmpty(result)) { result = assertNotNull(String.format("Can't recognize OS: %s", SystemUtils.OS_NAME), SysUtils.findGoSdkOsType()); } } return result; } @Nullable public String getArch() { String result = this.arch; if (isSafeEmpty(result)) { result = assertNotNull(String.format("Can't recognize ARCH: %s", SystemUtils.OS_ARCH), SysUtils.decodeGoSdkArchType(SystemUtils.OS_ARCH)); } return result; } @Nullable private String getValueOrEnv(@Nonnull final String varName, @Nullable final String configValue) { final String foundInEnvironment = System.getenv(varName); String result = configValue; if (foundInEnvironment != null && isUseEnvVars()) { if (!isSafeEmpty(configValue)) { getLog().warn(String.format("Value %s is replaced by environment value.", varName)); } result = foundInEnvironment; } return result; } @Nullable public String getGoRoot() { return getValueOrEnv("GOROOT", this.goRoot); } @Nullable public String getGoCache() { return getValueOrEnv("GOCACHE", this.goCache); } @Nullable public String getGoRootBootstrap() { return getValueOrEnv("GOROOT_BOOTSTRAP", this.goRootBootstrap); } @Nullable public String getGoBin() { String result = getValueOrEnv("GOBIN", this.goBin); return "NONE".equals(result) ? null : result; } @Nonnull public String getGoPath() { return assertNotNull(getValueOrEnv("GOPATH", this.goPath)); } @Nullable public String getTargetArm() { return getValueOrEnv("GOARM", this.targetArm); } @Nullable public String getTarget386() { return getValueOrEnv("GO386", this.target386); } @Nullable public String getTargetOS() { return getValueOrEnv("GOOS", this.targetOs); } @Nullable public String getTargetArch() { return getValueOrEnv("GOARCH", this.targetArch); } public boolean isUseMavenProxy() { return this.useMavenProxy; } public boolean getSupposeSdkArchiveFileName() { return this.supposeSdkArchiveFileName; } public boolean isDisableSslCheck() { return this.disableSSLcheck || Boolean.parseBoolean( findProperty(this.getSession(), this.getProject(), "mvn.golang.disable.ssl.check", "false")); } public void setDisableSslCheck(final boolean flag) { this.disableSSLcheck = flag; } @Nullable public ProxySettings getProxy() { return this.proxy; } @Nullable public String getOSXVersion() { return this.osxVersion; } @Nonnull public String getGoVersion() { return findProperty(this.session, this.project, "mvn.golang.go.version", this.goVersion); } @Nonnull public File getSources(final boolean ensureExist) throws IOException { final File result = new File(this.sources); if (ensureExist && !result.isDirectory()) { throw new IOException("Can't find GoLang project sources : " + result); } return result; } protected void addTmpBuildFlagIfNotPresented(@Nonnull @MustNotContainNull final String... flags) { for (final String s : flags) { if (this.tempBuildFlags.contains(s)) { continue; } boolean found = false; if (this.buildFlags != null) { for (final String b : this.buildFlags) { if (s.equals(b)) { found = true; break; } } } if (!found) { this.tempBuildFlags.add(s); } } } @Nullable private ProxySettings extractProxySettings() { final ProxySettings result; if (this.isUseMavenProxy()) { final Proxy activeMavenProxy = this.settings == null ? null : this.settings.getActiveProxy(); result = activeMavenProxy == null ? null : new ProxySettings(activeMavenProxy); getLog().debug("Detected maven proxy : " + result); } else { result = this.proxy; if (result != null) { getLog().debug("Defined proxy : " + result); } } return result; } @ReturnsOriginal @Nonnull private RequestConfig.Builder processRequestConfig(@Nullable final ProxySettings proxySettings, final int timeout, @Nonnull final RequestConfig.Builder config) { this.getLog() .debug("Connection(timeout=" + timeout + "ms, proxySettings=" + proxySettings + ')'); if (proxySettings != null) { final HttpHost proxyHost = new HttpHost(proxySettings.host, proxySettings.port, proxySettings.protocol); config.setProxy(proxyHost); } return config.setConnectTimeout(timeout).setSocketTimeout(timeout); } @Nonnull private String loadGoLangSdkList(@Nullable final ProxySettings proxySettings, @Nullable final String keyPrefix) throws IOException, MojoExecutionException { final String sdksite = getSdkSite() + (keyPrefix == null ? "" : "?prefix=" + keyPrefix); getLog().warn("Loading list of available GoLang SDKs from " + sdksite); final HttpGet get = new HttpGet(sdksite); final RequestConfig config = processRequestConfig(proxySettings, this.getConnectionTimeout(), RequestConfig.custom()) .build(); get.setConfig(config); get.addHeader("Accept", "application/xml"); try { final HttpResponse response = getHttpClient(proxySettings).execute(get); final StatusLine statusLine = response.getStatusLine(); if (statusLine.getStatusCode() == HttpStatus.SC_OK) { final String content = EntityUtils.toString(response.getEntity()); getLog().info("GoLang SDK list has been loaded successfuly"); getLog().debug(content); return content; } else { throw new IOException(String .format("Can't load list of SDKs from %s : %d %s", sdksite, statusLine.getStatusCode(), statusLine.getReasonPhrase())); } } finally { get.releaseConnection(); } } @Nonnull private Document convertSdkListToDocument(@Nonnull final String sdkListAsString) throws IOException { try { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); final DocumentBuilder builder = factory.newDocumentBuilder(); return builder.parse(new InputSource(new StringReader(sdkListAsString))); } catch (ParserConfigurationException ex) { getLog().error("Can't configure XML parser", ex); throw new IOException("Can't configure XML parser", ex); } catch (SAXException ex) { getLog().error("Can't parse document", ex); throw new IOException("Can't parse document", ex); } catch (IOException ex) { getLog().error("Unexpected IOException", ex); throw new IOException("Unexpected IOException", ex); } } private void printEcho() { if (this.echoWarn != null) { for (final String s : this.echoWarn) { getLog().warn(s); } } if (this.echo != null) { for (final String s : this.echo) { getLog().info(s); } } } protected void logOptionally(@Nonnull final String message) { if (getLog().isDebugEnabled() || this.verbose) { getLog().info(message); } } protected void initConsoleBuffers() { getLog().debug("Initing console out and console err buffers"); this.consoleErrBuffer = new ByteArrayOutputStream(); this.consoleOutBuffer = new ByteArrayOutputStream(); } @ReturnsOriginal @Nonnull private File unpackArchToFolder(@Nonnull final File archiveFile, @Nonnull final String folderInArchive, @Nonnull final File destinationFolder) throws IOException { getLog().info(String.format("Unpacking archive %s to folder %s", archiveFile.getName(), destinationFolder.getName())); boolean detectedError = true; try { final int unpackedFileCounter = UnpackUtils .unpackFileToFolder(getLog(), folderInArchive, archiveFile, destinationFolder, true); if (unpackedFileCounter == 0) { throw new IOException( "Couldn't find folder '" + folderInArchive + "' in archive or the archive is empty"); } else { getLog().info("Unpacked " + unpackedFileCounter + " file(s)"); } detectedError = false; } finally { if (detectedError && !isKeepUnarchFolderIfError()) { logOptionally("Deleting folder because error during unpack : " + destinationFolder); FileUtils.deleteQuietly(destinationFolder); } } return destinationFolder; } @Nonnull private String extractSDKFileName(@Nonnull final String listUrl, @Nonnull final Document doc, @Nonnull final String sdkBaseName, @Nonnull @MustNotContainNull final String[] allowedExtensions) throws IOException { getLog().debug("Looking for SDK started with base name : " + sdkBaseName); final Set variants = new HashSet<>(); for (final String ext : allowedExtensions) { variants.add(sdkBaseName + '.' + ext); } final List listedSdk = new ArrayList<>(); final Element root = doc.getDocumentElement(); if ("ListBucketResult".equals(root.getTagName())) { final NodeList list = root.getElementsByTagName("Contents"); for (int i = 0; i < list.getLength(); i++) { final Element element = (Element) list.item(i); final NodeList keys = element.getElementsByTagName("Key"); if (keys.getLength() > 0) { final String text = keys.item(0).getTextContent(); if (variants.contains(text)) { logOptionally("Detected compatible SDK in the SDK list : " + text); return text; } else { listedSdk.add(text); } } } if (this.supposeSdkArchiveFileName) { final String supposedSdkName = sdkBaseName + '.' + (SystemUtils.IS_OS_WINDOWS ? "zip" : "tar.gz"); getLog().warn("Can't find SDK file in the loaded list"); getLog().debug(".................................................."); for (final String s : listedSdk) { getLog().debug(s); } getLog().debug(".................................................."); getLog().warn("Supposed name of SDK archive is " + supposedSdkName + ", trying to load it directly! It can be disabled with false)"); return supposedSdkName; } getLog().error("Can't find any SDK to be used as " + sdkBaseName); getLog().error("GoLang list contains listed SDKs (" + listUrl + ")"); getLog().error( "It is possible directly define link to SDK through configuration parameter .."); getLog().error(".................................................."); for (final String s : listedSdk) { getLog().error(s); } throw new IOException("Can't find SDK : " + sdkBaseName); } else { throw new IOException("It is not a ListBucket file [" + root.getTagName() + ']'); } } @Nonnull private String findSdkArchiveFileName(@Nullable final ProxySettings proxySettings, @Nonnull final String sdkBaseName) throws IOException, MojoExecutionException { String result = getSdkArchiveName(); if (isSafeEmpty(result)) { final Document parsed = convertSdkListToDocument( loadGoLangSdkList(proxySettings, URLEncoder.encode(sdkBaseName, "UTF-8"))); result = extractSDKFileName(getSdkSite(), parsed, sdkBaseName, new String[] {"tar.gz", "zip"}); } else { getLog().info("SDK archive name is predefined : " + result); } return GetUtils.ensureNonNullStr(result); } private void warnIfContainsUC(@Nonnull final String message, @Nonnull final String str) { boolean detected = false; for (final char c : str.toCharArray()) { if (Character.isUpperCase(c)) { detected = true; break; } } if (detected) { getLog().warn(message + " : " + str); } } @Nonnull protected File findGoRoot(@Nullable final ProxySettings proxySettings) throws IOException, MojoFailureException, MojoExecutionException { final File result; LOCKER.lock(); try { final String predefinedGoRoot = this.getGoRoot(); if (isSafeEmpty(predefinedGoRoot)) { final File cacheFolder = new File(this.storeFolder); if (!cacheFolder.isDirectory()) { if (cacheFolder.isFile()) { throw new IOException("Can't create folder '" + cacheFolder + "' because there is presented a file with such name!"); } logOptionally("Making SDK cache folder : " + cacheFolder); FileUtils.forceMkdir(cacheFolder); } final String definedOsxVersion = this.getOSXVersion(); final String sdkVersion = this.getGoVersion(); this.getLog().debug( String.format("SdkVersion = %s, osxVersion = %s", sdkVersion, definedOsxVersion)); if (isSafeEmpty(sdkVersion)) { throw new MojoFailureException("GoLang SDK version is not defined!"); } final String sdkBaseName = String .format(NAME_PATTERN, sdkVersion, this.getOs(), this.getArch(), isSafeEmpty(definedOsxVersion) ? "" : "-" + definedOsxVersion); warnIfContainsUC("Prefer usage of lower case chars only for SDK base name", sdkBaseName); result = loadSDKAndUnpackIntoCache(proxySettings, cacheFolder, sdkBaseName, isDisableSdkLoad()); } else { logOptionally("Detected predefined SDK root folder : " + predefinedGoRoot); result = new File(predefinedGoRoot); if (!result.isDirectory()) { throw new MojoFailureException("Predefined SDK root is not a directory : " + result); } } } finally { LOCKER.unlock(); } return result; } private void printBanner() { for (final String s : BANNER) { getLog().info(s); } } public boolean isHideBanner() { return this.hideBanner; } protected boolean doesNeedOneMoreAttempt(@Nonnull final ProcessResult result, @Nonnull final String consoleOut, @Nonnull final String consoleErr) throws IOException, MojoExecutionException { return false; } protected void doLogging( final int resultCode, final boolean error, @Nonnull final String outLog, @Nonnull final String errLog ) throws MojoExecutionException { if (getLog().isDebugEnabled()) { getLog().debug("OUT_LOG: " + outLog); getLog().debug("ERR_LOG: " + errLog); } this.processLogFiles(outLog, errLog); this.printLogs( error || isEnforcePrintOutput() || (this.isVerbose() && this.isCommandSupportVerbose()), error, outLog, errLog); } protected boolean doMainBusiness(@Nullable final ProxySettings proxySettings, final int maxAttempts) throws InterruptedException, MojoFailureException, MojoExecutionException, IOException { int iterations = 0; boolean error = false; while (!Thread.currentThread().isInterrupted()) { final ProcessExecutor executor = prepareExecutor(proxySettings); if (executor == null) { logOptionally("The Mojo should not be executed"); break; } final ProcessResult result = executor.executeNoTimeout(); final int resultCode = result.getExitValue(); error = resultCode != 0 && !isIgnoreErrorExitCode(); iterations++; final String outLog = extractOutAsString(); final String errLog = extractErrorOutAsString(); this.doLogging(resultCode, error, outLog, errLog); if (doesNeedOneMoreAttempt(result, outLog, errLog)) { if (iterations > maxAttempts) { throw new MojoExecutionException( "Too many iterations detected, may be some loop and bug at mojo " + this.getClass().getName()); } getLog().warn("Make one more attempt..."); } else { if (!isIgnoreErrorExitCode()) { assertProcessResult(result); } break; } } return error; } @Override public final void execute() throws MojoExecutionException, MojoFailureException { if (this.isSkip()) { getLog().info("Skipping mvn-golang execution"); } else { if (this.doesNeedSessionLock()) { lockMvnGolangSession(); if (Thread.currentThread().isInterrupted()) { throw new MojoFailureException("Current thread is interrupted"); } } try { if (!isHideBanner()) { printBanner(); } doInit(); printEcho(); final ProxySettings proxySettings = extractProxySettings(); beforeExecution(proxySettings); Exception exception = null; boolean errorDuringMainBusiness = false; try { errorDuringMainBusiness = doMainBusiness(proxySettings, 10); } catch (final IOException | InterruptedException | MojoExecutionException | MojoFailureException ex) { if (ex instanceof InterruptedException) { Thread.currentThread().interrupt(); } exception = ex; } finally { afterExecution(null, errorDuringMainBusiness || exception != null); } if (exception != null) { throw new MojoExecutionException(exception.getMessage(), exception); } else if (errorDuringMainBusiness) { throw new MojoFailureException("Mojo execution failed, see log"); } } finally { if (this.doesNeedSessionLock()) { unlockMvnGolangSession(); } } } } public void doInit() throws MojoFailureException, MojoExecutionException { } public void beforeExecution(@Nullable final ProxySettings proxySettings) throws MojoFailureException, MojoExecutionException { } public void afterExecution(@Nullable final ProxySettings proxySettings, final boolean error) throws MojoFailureException, MojoExecutionException { } public boolean isEnforcePrintOutput() { return false; } @Nonnull private String extractOutAsString() { return new String(this.consoleOutBuffer.toByteArray(), Charset.defaultCharset()); } @Nonnull private String extractErrorOutAsString() { return new String(this.consoleErrBuffer.toByteArray(), Charset.defaultCharset()); } protected void printLogs(final boolean forcePrint, final boolean errorDetected, @Nonnull final String outLog, @Nonnull final String errLog) { final boolean outLogNotEmpty = !outLog.isEmpty(); final boolean errLogNotEmpty = !errLog.isEmpty(); if (outLogNotEmpty) { if (forcePrint || getLog().isDebugEnabled()) { getLog().info(""); getLog().info("---------Exec.Out---------"); for (final String str : outLog.split("\n")) { getLog().info(StrUtils.trimRight(str)); } getLog().info(""); } else { getLog().debug("There is not any log out from the process"); } } if (errLogNotEmpty) { if (forcePrint) { if (errorDetected) { getLog().error(""); getLog().error("---------Exec.Err---------"); for (final String str : errLog.split("\n")) { getLog().error(StrUtils.trimRight(str)); } getLog().error(""); } else { getLog().warn(""); getLog().warn("---------Exec.Err---------"); for (final String str : errLog.split("\n")) { getLog().warn(StrUtils.trimRight(str)); } getLog().warn(""); } } else { getLog().debug("---------Exec.Err---------"); for (final String str : errLog.split("\n")) { getLog().debug(StrUtils.trimRight(str)); } } } else { getLog().debug("Error log buffer is empty"); } } private void assertProcessResult(@Nonnull final ProcessResult result) throws MojoFailureException { final int code = result.getExitValue(); if (code != 0) { throw new MojoFailureException("Process exit code : " + code); } } public boolean isSourceFolderRequired() { return false; } public boolean isMojoMustNotBeExecuted() throws MojoFailureException { try { return isSourceFolderRequired() && !this.getSources(false).isDirectory(); } catch (IOException ex) { throw new MojoFailureException("Can't check source folder", ex); } } @Nonnull @MustNotContainNull public abstract String[] getTailArguments(); @Nonnull @MustNotContainNull public String[] getOptionalExtraTailArguments() { return ArrayUtils.EMPTY_STRING_ARRAY; } @Nonnull public String makeExecutableFileSubpath() { return getExecSubpath() + File.separatorChar + getExec(); } @Nonnull public abstract String getGoCommand(); @Nonnull @MustNotContainNull public abstract String[] getCommandFlags(); @Nullable private String getEnvPath() { String path = System.getenv("PATH"); if (path == null) { this.getLog().warn("Can't find any defined PATH in environment"); } else { this.getLog().debug("Found env.PATH: " + path); } final boolean filter = this.isFilterEnvPath(); if (path != null) { final StringBuilder buffer = new StringBuilder(); for (final String s : path.split(Pattern.quote(File.pathSeparator))) { if (filter && GOBINFOLDER_PATTERN.matcher(s).find()) { getLog().debug("Removing item '" + s + "' from PATH because it looks like go/bin"); continue; } if (buffer.length() > 0) { buffer.append(File.pathSeparator); } buffer.append(s); getLog().debug("Add item '" + s + "' to PATH"); } path = buffer.toString(); } this.getLog().debug("Prepared PATH var content:" + path); return path; } private void addEnvVar(@Nonnull final ProcessExecutor executor, @Nonnull final String name, @Nonnull final String value) { logOptionally(" $" + name + " = " + value); executor.environment(name, value); } @Nonnull private synchronized HttpClient getHttpClient(@Nullable final ProxySettings proxy) throws MojoExecutionException { if (this.httpClient == null) { final HttpClientBuilder builder = HttpClients.custom(); if (proxy != null) { if (proxy.hasCredentials()) { final CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); credentialsProvider.setCredentials(new AuthScope(proxy.host, proxy.port), new NTCredentials(GetUtils.ensureNonNull(proxy.username, ""), proxy.password, extractComputerName(), extractDomainName())); builder.setDefaultCredentialsProvider(credentialsProvider); getLog().debug(String .format("Credentials provider has been created for proxy (username : %s): %s", proxy.username, proxy)); } final String[] ignoreForAddresses = proxy.nonProxyHosts == null ? new String[0] : proxy.nonProxyHosts.split("\\|"); final WildCardMatcher[] matchers; if (ignoreForAddresses.length > 0) { matchers = new WildCardMatcher[ignoreForAddresses.length]; for (int i = 0; i < ignoreForAddresses.length; i++) { matchers[i] = new WildCardMatcher(ignoreForAddresses[i]); } } else { matchers = new WildCardMatcher[0]; } getLog().debug("Regular routing mode"); final HttpRoutePlanner routePlanner = new DefaultProxyRoutePlanner(new HttpHost(proxy.host, proxy.port, proxy.protocol)) { @Override @Nonnull public HttpRoute determineRoute(@Nonnull final HttpHost host, @Nonnull final HttpRequest request, @Nonnull final HttpContext context) throws HttpException { HttpRoute result = null; final String hostName = host.getHostName(); for (final WildCardMatcher m : matchers) { if (m.match(hostName)) { getLog().debug("Ignoring proxy for host : " + hostName); result = new HttpRoute(host); break; } } if (result == null) { result = super.determineRoute(host, request, context); } getLog().debug("Made connection route : " + result); return result; } }; builder.setRoutePlanner(routePlanner); getLog().debug("Proxy will ignore: " + Arrays.toString(matchers)); } builder.setUserAgent("mvn-golang-wrapper-agent/1.0"); builder.disableCookieManagement(); if (this.isDisableSslCheck()) { this.getLog().warn("SSL certificate check is disabled"); try { final SSLContext sslcontext = SSLContext.getInstance("TLS"); X509TrustManager tm = new X509TrustManager() { @Override public void checkClientTrusted( @Nonnull @MustNotContainNull final X509Certificate[] arg0, @Nonnull final String arg1) throws CertificateException { } @Override public void checkServerTrusted( @Nonnull @MustNotContainNull final X509Certificate[] arg0, @Nonnull String arg1) throws CertificateException { } @Override @Nullable @MustNotContainNull public X509Certificate[] getAcceptedIssuers() { return null; } }; sslcontext.init(null, new TrustManager[] {tm}, null); final SSLConnectionSocketFactory sslfactory = new SSLConnectionSocketFactory(sslcontext, NoopHostnameVerifier.INSTANCE); final Registry r = RegistryBuilder.create() .register("https", sslfactory) .register("http", new PlainConnectionSocketFactory()).build(); builder.setConnectionManager(new BasicHttpClientConnectionManager(r)); builder.setSSLSocketFactory(sslfactory); builder.setSSLContext(sslcontext); } catch (final KeyManagementException | NoSuchAlgorithmException ex) { throw new MojoExecutionException("Can't disable SSL certificate check", ex); } } else { this.getLog().debug("SSL check is enabled"); } this.httpClient = builder.build(); } return this.httpClient; } protected void registerOutputBuffers(@Nonnull final ProcessExecutor executor) { executor.redirectOutput(this.consoleOutBuffer); executor.redirectError(this.consoleErrBuffer); } protected void registerEnvVars( @Nonnull final ProcessExecutor result, @Nonnull final File theGoRoot, @Nullable final String theGoBin, @Nullable final String theGoCache, @Nonnull final File sourcesFile, @MustNotContainNull @Nonnull final File[] goPathParts ) throws IOException { logOptionally("....Environment vars...."); addEnvVar(result, "GOROOT", theGoRoot.getAbsolutePath()); this.project.getProperties().setProperty("mvn.golang.last.goroot", theGoRoot.getAbsolutePath()); String preparedGoPath = IOUtils.makeOsFilePathWithoutDuplications(goPathParts); if (isEnforceGoPathToEnd()) { preparedGoPath = IOUtils.makeOsFilePathWithoutDuplications(makePathFromExtraGoPathElements(), removeSrcFolderAtEndIfPresented(sourcesFile.getAbsolutePath()), getSpecialPartOfGoPath(), preparedGoPath); } else { preparedGoPath = IOUtils .makeOsFilePathWithoutDuplications(preparedGoPath, makePathFromExtraGoPathElements(), removeSrcFolderAtEndIfPresented(sourcesFile.getAbsolutePath()), getSpecialPartOfGoPath()); } addEnvVar(result, "GOPATH", preparedGoPath); this.project.getProperties().setProperty("mvn.golang.last.gopath", preparedGoPath); if (theGoBin == null) { getLog().warn("GOBIN is disabled by direct order"); } else { addEnvVar(result, "GOBIN", theGoBin); this.project.getProperties().setProperty("mvn.golang.last.gobin", theGoBin); } if (theGoBin == null) { getLog().warn("GOCACHE is not provided by direct order"); } else { addEnvVar(result, "GOCACHE", theGoCache); this.project.getProperties().setProperty("mvn.golang.last.gocache", theGoCache); } final String trgtOs = this.getTargetOS(); final String trgtArch = this.getTargetArch(); final String trgtArm = this.getTargetArm(); final String trgt386 = this.getTarget386(); if (trgt386 != null) { addEnvVar(result, "GO386", trgt386); this.project.getProperties().setProperty("mvn.golang.last.go386", trgt386); } if (trgtOs != null) { addEnvVar(result, "GOOS", trgtOs); this.project.getProperties().setProperty("mvn.golang.last.goos", trgtOs); } if (trgtArm != null) { addEnvVar(result, "GOARM", trgtArm); this.project.getProperties().setProperty("mvn.golang.last.goarm", trgtArm); } if (trgtArch != null) { addEnvVar(result, "GOARCH", trgtArch); this.project.getProperties().setProperty("mvn.golang.last.goarch", trgtArch); } final File gorootbootstrap = findGoRootBootstrap(true); if (gorootbootstrap != null) { addEnvVar(result, "GOROOT_BOOTSTRAP", gorootbootstrap.getAbsolutePath()); this.project.getProperties() .setProperty("mvn.golang.last.goroot_bootstrap", gorootbootstrap.getAbsolutePath()); } String thePath = GetUtils.ensureNonNull(getEnvPath(), ""); thePath = IOUtils .makeOsFilePathWithoutDuplications((theGoRoot + File.separator + getExecSubpath()), thePath, theGoBin); addEnvVar(result, "PATH", thePath); this.project.getProperties().setProperty("mvn.golang.last.path", thePath); boolean go111moduleDetected = false; for (final Map.Entry record : getEnv().entrySet()) { if (ENV_GO111MODULE.equals(record.getKey().toString())) { go111moduleDetected = true; } addEnvVar(result, record.getKey().toString(), GetUtils.ensureNonNull(record.getValue(), "").toString()); } if (this.isModuleMode()) { if (go111moduleDetected) { this.getLog().warn(String .format("Module mode is true but %s detected among custom environment parameters", ENV_GO111MODULE)); } else { this.getLog().warn( String.format("Forcing '%s = on' because module mode is activated", ENV_GO111MODULE)); addEnvVar(result, ENV_GO111MODULE, "on"); } } } @Nonnull @MustNotContainNull protected List findAllGoModsInFolder(@Nonnull @MustNotContainNull final File folder) throws IOException { return new ArrayList<>(FileUtils .listFiles(folder, FileFilterUtils.nameFileFilter(GO_MOD_FILE_NAME), TrueFileFilter.INSTANCE)); } @Nonnull protected File getWorkingDirectoryForExecutor() throws IOException { final String forcedWorkingDirdir = this.getWorkingDir(); if (forcedWorkingDirdir != null) { final File result = new File(forcedWorkingDirdir); if (!result.isDirectory()) { throw new IOException("Working directory doesn't exist: " + result); } return result; } if (this.isModuleMode()) { final File srcFolder = this.getSources(false); if (srcFolder.isDirectory()) { final List foundGoMods = this.findAllGoModsInFolder(srcFolder); this.getLog().debug(String .format("Detected %d go.mod files in source folder %s", foundGoMods.size(), srcFolder)); foundGoMods.sort(Comparator.comparing(File::toString)); if (foundGoMods.isEmpty()) { this.getLog().error( "Module mode is activated but there is no any go.mod file in the source folder: " + srcFolder); throw new IOException("Can't find any go.mod folder in the source folder: " + srcFolder); } else { final File gomodFolder = foundGoMods.get(0).getParentFile(); this.getLog().info(String .format("Detected module folder '%s' in use as working folder", gomodFolder)); return gomodFolder; } } else { this.getLog().debug("Source folder is not found: " + srcFolder); } } return this.getSources(isSourceFolderRequired()); } /** * Internal method which returns special part of GOPATH which can be formed by * mojos. Must be either empty or contain folders divided by file path * separator. * * @return special part of GOPATH, must not be null, by default must be empty */ @Nonnull protected String getSpecialPartOfGoPath() { return ""; } @Nonnull protected String makePathFromExtraGoPathElements() { String result = ""; if (this.addToGoPath != null) { result = IOUtils.makeOsFilePathWithoutDuplications(this.addToGoPath); } return result; } public boolean isCommandSupportVerbose() { return false; } @Nullable protected String getSkipMojoPropertySuffix() { return null; } @Nullable protected ProcessExecutor prepareExecutor(@Nullable final ProxySettings proxySettings) throws IOException, MojoFailureException, MojoExecutionException { initConsoleBuffers(); final String execNameAdaptedForOs = adaptExecNameForOS(makeExecutableFileSubpath()); final File detectedRoot = findGoRoot(proxySettings); final String gobin = getGoBin(); final String gocache = getGoCache(); final File[] gopathParts = findGoPath(true); if (isMojoMustNotBeExecuted()) { return null; } final String toolName = FilenameUtils.normalize(GetUtils.ensureNonNull(getUseGoTool(), execNameAdaptedForOs)); final File executableFileInPathOrRoot = new File(getPathToFolder(detectedRoot) + toolName); final File executableFileInBin = gobin == null ? null : new File(getPathToFolder(gobin) + adaptExecNameForOS(getExec())); final File[] exeVariants = new File[] {executableFileInBin, executableFileInPathOrRoot}; final File foundExecutableTool = findExisting(exeVariants); if (foundExecutableTool == null) { throw new MojoFailureException( "Can't find executable file : " + Arrays.toString(exeVariants)); } else { logOptionally("Executable file detected : " + foundExecutableTool); } final List commandLine = new ArrayList<>(); commandLine.add(foundExecutableTool.getAbsolutePath()); final String gocommand = getGoCommand(); if (!gocommand.isEmpty()) { commandLine.add(getGoCommand()); } boolean verboseAdded = false; for (final String s : getCommandFlags()) { if (s.equals("-v")) { verboseAdded = true; } commandLine.add(s); } if (this.isVerbose() && !verboseAdded && isCommandSupportVerbose()) { commandLine.add("-v"); } commandLine.addAll(Arrays.asList(getBuildFlags())); commandLine.addAll(Arrays.asList(getTailArguments())); commandLine.addAll(Arrays.asList(getOptionalExtraTailArguments())); final StringBuilder cli = new StringBuilder(); int index = 0; for (final String s : commandLine) { if (cli.length() > 0) { cli.append(' '); } if (index == 0) { cli.append(execNameAdaptedForOs); } else { cli.append(s); } index++; } getLog().info(String.format("Prepared command line : %s", cli)); final ProcessExecutor result = new ProcessExecutor(commandLine); final File workingDirectory = this.getWorkingDirectoryForExecutor(); if (workingDirectory.isDirectory()) { logOptionally("Working directory: " + workingDirectory); result.directory(workingDirectory); } else { logOptionally("Working directory is not set because provided folder doesn't exist: " + workingDirectory); } logOptionally(""); registerEnvVars(result, detectedRoot, gobin, gocache, this.getSources(this.isSourceFolderRequired()), gopathParts); logOptionally("........................"); registerOutputBuffers(result); return result; } private void processLogFiles(@Nonnull final String logOut, @Nonnull final String logErr) throws MojoExecutionException { final File reportsFolderFile = new File(this.getReportsFolder()); final String targetOutFileName = nullIfBlank(this.getOutLogFile()); final String targetErrFileName = nullIfBlank(this.getErrLogFile()); if (targetErrFileName != null ^ targetOutFileName != null) { if (targetOutFileName == null && !logOut.isEmpty()) { this.getLog() .warn("File logging for ERR stream is ON but also detected text in output stream!"); } if (targetErrFileName == null && !logErr.isEmpty()) { this.getLog() .warn("File logging for OUT stream is ON but also detected text in error stream!"); } } this.getLog().debug("log.file.out: " + targetOutFileName); this.getLog().debug("log.file.err: " + targetErrFileName); final File targetOutFile = targetOutFileName == null ? null : new File(reportsFolderFile, targetOutFileName); final File targetErrFile = targetErrFileName == null ? null : new File(reportsFolderFile, targetErrFileName); if (targetOutFile == null) { this.getLog().debug("Log file to write output stream is not set"); } else { getLog().debug("Reports folder : " + reportsFolderFile); if (!reportsFolderFile.isDirectory() && !reportsFolderFile.mkdirs()) { throw new MojoExecutionException( "Can't create folder for console logs : " + reportsFolderFile); } try { getLog().debug( "Writing " + logOut.length() + " chars as output console log : " + targetOutFile); FileUtils.write(targetOutFile, logOut, "UTF-8"); } catch (IOException ex) { throw new MojoExecutionException( "Can't save console output log into file : " + targetOutFile, ex); } } if (targetErrFile == null) { this.getLog().debug("Log file to write error stream is not set"); } else { getLog().debug("Reports folder : " + reportsFolderFile); if (!reportsFolderFile.isDirectory() && !reportsFolderFile.mkdirs()) { throw new MojoExecutionException( "Can't create folder for console logs : " + reportsFolderFile); } try { getLog().debug( "Writing " + logErr.length() + " chars as error console log : " + targetErrFile); FileUtils.write(targetErrFile, logErr, "UTF-8"); } catch (IOException ex) { throw new MojoExecutionException( "Can't save console error log into file : " + targetErrFile, ex); } } } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/AbstractModuleAware.java ================================================ package com.igormaznitsa.mvngolang; import com.igormaznitsa.meta.annotation.MustNotContainNull; import com.igormaznitsa.meta.common.utils.ArrayUtils; import org.apache.maven.plugins.annotations.Parameter; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.List; public abstract class AbstractModuleAware extends AbstractGoPackageAndDependencyAwareMojo { /** * Parameter allows define '-mod' parameter for command in format '-mod=value'. * Also can be defined through property 'mvn.golang.module.mod' * If the parameter is empty then it will not be added into command line and current default GoSDK value will be in use. * * @since 2.3.8 */ @Parameter(name = "mod") protected String mod = null; @Nullable public String getMod() { return findMvnProperty("mvn.golang.module.mod", this.mod); } @Override @Nonnull @MustNotContainNull public final String[] getCommandFlags() { final List result = new ArrayList<>(); Collections.addAll(result, this.getAdditionalCommandFlags()); final String moduleMod = this.getMod(); if (moduleMod != null && moduleMod.trim().length() != 0) { if (result.stream().anyMatch(x -> x.startsWith("-mod="))) { this.getLog().warn("Detected direct 'mod' flag, configuration 'mod' option will be ignored"); } else { this.getLog().debug("Detected mod value: " + moduleMod); result.add(0, String.format("-mod=%s", moduleMod.trim())); } } return result.toArray(new String[0]); } @Nonnull @MustNotContainNull protected String[] getAdditionalCommandFlags() { return ArrayUtils.EMPTY_STRING_ARRAY; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/CustomScript.java ================================================ /* * Copyright 2018 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; /** * Auxiliary class describes a custom script to be called for CVS folder. * * @since 2.1.8 */ public class CustomScript { /** * Path to the script. */ public String path; /** * Options to be provided to the script. */ public String[] options; /** * If true then to not recognize execution error as fail. */ public boolean ignoreFail = false; } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/GolangBuildMojo.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.meta.annotation.MustNotContainNull; import com.igormaznitsa.meta.common.utils.GetUtils; import com.igormaznitsa.mvngolang.utils.ProxySettings; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.*; import org.apache.maven.project.MavenProjectHelper; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import static com.igormaznitsa.meta.common.utils.Assertions.assertNotNull; /** * The Mojo wraps the 'build' command. */ @Mojo(name = "build", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE) public class GolangBuildMojo extends AbstractModuleAware { @Component private MavenProjectHelper projectHelper; /** * Flag to attach build result file as artifact to the maven session. * Also can be set through property mvn.golang.build.attach * * @since 2.3.7 */ @Parameter(name = "attach", defaultValue = "false") private boolean attach; /** * Classifier for result file attachment. * Also can be set through property mvn.golang.build.attach.classifier * @since 2.3.7 */ @Parameter(name = "attachClassifier") private String attachClassifier; /** * Type for result file attachment. * Also can be set through property mvn.golang.build.attach.type * @since 2.3.7 */ @Parameter(name = "attachType", defaultValue = "bin") private String attachType; /** * Target folder where to place the result file. */ @Parameter(name = "resultFolder", defaultValue = "${project.build.directory}") private String resultFolder; /** * Name of the result file. * By default it uses ${project.build.finalName} */ @Parameter(name = "resultName", defaultValue = "${project.build.finalName}") private String resultName; /** * Build mode indicates which kind of object file is to be built. * * @since 2.1.3 */ @Parameter(name = "buildMode", defaultValue = "default") private String buildMode; /** * Strip result file. Symbol table and DWARF will be removed from the result * file. * * @since 2.1.3 */ @Parameter(name = "strip", defaultValue = "false") private boolean strip; /** * List of linker flags. *
   * {@code
   *      
   *        -a
   *        main.prodVersion=1.2.3
   *      
   * }
   * 
* * @since 2.1.3 */ @Parameter(name = "ldFlags") private String[] ldFlags; public boolean isAttach() { return Boolean.parseBoolean(findMvnProperty("mvn.golang.build.attach", Boolean.toString(this.attach))); } @Nullable public String getAttachClassifier() { return findMvnProperty("mvn.golang.build.attach.classifier", this.attachClassifier); } @Nonnull public String getAttachType() { final String found = findMvnProperty("mvn.golang.build.attach.type", this.attachType); return GetUtils.ensureNonNull(found, "bin"); } @MustNotContainNull @Nonnull public List getLdflagsAsList() { return this.ldFlags == null ? new ArrayList<>() : new ArrayList<>(Arrays.asList(this.ldFlags)); } @Nullable @Override protected String getSkipMojoPropertySuffix() { return "build"; } public boolean isStrip() { return this.strip; } public void setStrip(final boolean flag) { this.strip = flag; } @Nonnull public String getBuildMode() { return this.buildMode; } public void setBuildMode(@Nullable final String buildMode) { this.buildMode = GetUtils.ensureNonNull(buildMode, "default"); } @Nonnull private File getResultFile() { return new File(getResultFolder(), this.getResultName()); } @Nonnull public String getResultFolder() { return assertNotNull(this.resultFolder); } public void setResultFolder(@Nonnull final String folder) { this.resultFolder = assertNotNull(folder); } @Nonnull public String getResultName() { return assertNotNull(this.resultName); } public void setResultName(@Nonnull final String resultName) { this.resultName = assertNotNull(resultName); } @Override @Nonnull public String getGoCommand() { return "build"; } @Override public void beforeExecution(@Nullable final ProxySettings proxySettings) throws MojoFailureException { final File folder = new File(getResultFolder()); if (!folder.isDirectory() && !folder.mkdirs()) { throw new MojoFailureException("Can't create folder : " + folder); } if (isVerbose() || !"default".equals(this.buildMode)) { getLog().info("Build mode : " + this.buildMode); } final String[] currentPackages = this.getPackages(); if (currentPackages != null && currentPackages.length > 1) { getLog().warn(String.format( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!%n" + "!Result file output is ignored because non-single package!%n" + "! see: 'go help build' for more info !%n" + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") ); } } @Override public void afterExecution(@Nullable final ProxySettings proxySettings, final boolean error) throws MojoFailureException { if (!error) { final File resultFile = getResultFile(); // check that it exists if (!resultFile.isFile()) { throw new MojoFailureException("Can't find generated target file : " + resultFile); } // softly try to make it executable try { if (!resultFile.setExecutable(true)) { getLog().warn("Can't make result file executable : " + resultFile); } } catch (SecurityException ex) { getLog().warn("Security exception during executable flag set : " + resultFile); } getLog().info("The Result file has been successfully created : " + resultFile); this.processAttach(resultFile); } } @Override public boolean isCommandSupportVerbose() { return true; } private void processAttach(@Nonnull final File resultFile) { if (this.isAttach()) { final String classifier = this.getAttachClassifier(); final String type = this.getAttachType(); this.getLog().info("Activated attach as artifact (classifier=" + classifier + ", type=" + type + "): " + resultFile); this.projectHelper.attachArtifact(this.getProject(), type, classifier, resultFile); } else { this.getLog().debug("Attach as artifact is turned off"); } } @Override @Nonnull @MustNotContainNull protected String[] getAdditionalCommandFlags() { final List flags = new ArrayList<>(); flags.add("-buildmode=" + this.getBuildMode()); final List linkerFlags = this.getLdflagsAsList(); if (this.strip) { if (!linkerFlags.contains("-s")) { linkerFlags.add("-s"); } if (!linkerFlags.contains("-w")) { linkerFlags.add("-w"); } } if (!linkerFlags.isEmpty()) { flags.add("-ldflags"); final StringBuilder buffer = new StringBuilder(); for (final String s : linkerFlags) { if (buffer.length() > 0) { buffer.append(' '); } buffer.append(s); } flags.add(buffer.toString()); } final String[] selectedPackages = this.getPackages(); final String selectedResultName = this.getResultName(); if (selectedPackages == null || selectedPackages.length < 2) { if ("none".equals(selectedResultName.trim())) { this.getLog().info("Result name is not defined so that '-o' option is not added."); } else { flags.add("-o"); flags.add(this.getResultFile().getAbsolutePath()); } } return flags.toArray(new String[0]); } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/GolangCleanMojo.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.mvngolang.utils.ProxySettings; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.codehaus.plexus.util.FileUtils; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.File; import java.io.IOException; /** * The Mojo wraps the 'clean' command. */ @Mojo(name = "clean", defaultPhase = LifecyclePhase.CLEAN, threadSafe = true) public class GolangCleanMojo extends AbstractGoPackageAndDependencyAwareMojo { /** * Clean all folders provided by Go Path. Be careful with the flag! * * @since 2.1.1 */ @Parameter(name = "cleanGoPath", defaultValue = "false") private boolean cleanGoPath; /** * Delete plugin Golang store folder It is folder where the plugin keeps * cached SDKs and packages. * * @since 2.1.1 */ @Parameter(name = "deleteStoreFolder", defaultValue = "false") private boolean deleteStoreFolder; @Override public boolean isSourceFolderRequired() { return true; } @Override @Nonnull public String getGoCommand() { return "clean"; } @Nullable @Override protected String getSkipMojoPropertySuffix() { return "clean"; } @Override public void beforeExecution(@Nullable final ProxySettings proxySettings) throws MojoFailureException, MojoExecutionException { super.beforeExecution(proxySettings); if (this.isModuleMode() && this.getBuildFlags().length == 0) { this.addTmpBuildFlagIfNotPresented("-modcache"); } } private void deleteStoreFolder() throws MojoFailureException { try { final File goStoreFolder = new File(getStoreFolder()); if (goStoreFolder.isDirectory()) { getLog().info("Deleting the Store Folder : " + goStoreFolder); FileUtils.deleteDirectory(goStoreFolder); } else { getLog().info("The Store Folder does not found : " + goStoreFolder); } } catch (IOException ex) { throw new MojoFailureException("Can't delete the Store Folder", ex); } } private void cleanGoPath() throws MojoFailureException { try { final File[] goPathFolders = findGoPath(false); for (final File f : goPathFolders) { if (f.isDirectory()) { getLog().warn("Cleaning the Go Path folder : " + f); FileUtils.cleanDirectory(f); } else { getLog().info("Can't find GOPATH folder : " + f); } } } catch (IOException ex) { throw new MojoFailureException("Can't clean the Go Path folder", ex); } } @Override public void afterExecution(@Nullable final ProxySettings proxySettings, final boolean error) throws MojoFailureException, MojoExecutionException { super.afterExecution(proxySettings, false); if (!error) { final File directory; if (getProject().getPackaging().equals(GOARTIFACT_PACKAGING)) { directory = new File(getProject().getBasedir(), "bin"); } else { directory = new File(getProject().getBuild().getDirectory()); } if (directory.isDirectory()) { try { getLog().info("Deleting folder : " + directory); FileUtils.deleteDirectory(directory); } catch (IOException ex) { throw new MojoFailureException("Can't delete folder", ex); } } else { getLog().info(String.format("Folder %s is not found", directory.getAbsolutePath())); } final File reportFolderFile = new File(getReportsFolder()); if (reportFolderFile.isDirectory()) { try { getLog().info("Deleting report folder : " + reportFolderFile); FileUtils.deleteDirectory(reportFolderFile); } catch (IOException ex) { throw new MojoExecutionException("Can't delete report folder : " + reportFolderFile); } } else { getLog().debug("There is no report folder : " + reportFolderFile); } if (this.cleanGoPath) { cleanGoPath(); } if (this.deleteStoreFolder) { deleteStoreFolder(); } } } @Override public boolean isIgnoreNonResolvableArtifact() { return true; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/GolangCustomMojo.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.meta.common.utils.GetUtils; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; /** * The Mojo allows to process commands which are not covered by MOJOs of the * plug-in. */ @Mojo(name = "custom", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true, requiresDependencyResolution = ResolutionScope.NONE) public class GolangCustomMojo extends AbstractGoPackageAndDependencyAwareMojo { /** * Command for Go tool to be executed */ @Parameter(name = "customCommand", required = true) private String customCommand; @Nullable @Override protected String getSkipMojoPropertySuffix() { return "clean"; } @Override @Nonnull public String getGoCommand() { return GetUtils.ensureNonNull(this.customCommand, ""); } @Override public boolean isEnforcePrintOutput() { return true; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/GolangFixMojo.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.meta.annotation.MustNotContainNull; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.ResolutionScope; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.File; /** * The Mojo wraps the 'fix' command. */ @Mojo(name = "fix", defaultPhase = LifecyclePhase.VALIDATE, threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE) public class GolangFixMojo extends AbstractModuleAware { @Override public boolean isSourceFolderRequired() { return true; } @Nullable @Override protected String getSkipMojoPropertySuffix() { return "fix"; } @Override @Nullable @MustNotContainNull protected String[] getDefaultPackages() { return new String[] {'.' + File.separator + "..."}; } @Override @Nonnull public String getGoCommand() { return "fix"; } @Override public boolean isEnforcePrintOutput() { return true; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/GolangFmtMojo.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.meta.annotation.MustNotContainNull; import java.io.File; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.ResolutionScope; /** * The Mojo wraps the 'fmt' command. */ @Mojo(name = "fmt", defaultPhase = LifecyclePhase.PROCESS_SOURCES, threadSafe = true, requiresDependencyResolution = ResolutionScope.NONE) public class GolangFmtMojo extends AbstractGoPackageAndDependencyAwareMojo { @Override @Nonnull public String getGoCommand() { return "fmt"; } @Nullable @Override protected String getSkipMojoPropertySuffix() { return "fmt"; } @Override @Nullable @MustNotContainNull protected String[] getDefaultPackages() { return new String[] {'.' + File.separator + "..."}; } @Override public boolean isSourceFolderRequired() { return true; } @Override public boolean isEnforcePrintOutput() { return true; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/GolangGenerateMojo.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.meta.annotation.MustNotContainNull; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.ResolutionScope; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.File; /** * The Mojo wraps the 'generate' command. */ @Mojo(name = "generate", defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE) public class GolangGenerateMojo extends AbstractModuleAware { @Override @Nonnull public String getGoCommand() { return "generate"; } @Nullable @Override protected String getSkipMojoPropertySuffix() { return "generate"; } @Override @Nullable @MustNotContainNull protected String[] getDefaultPackages() { return new String[] {'.' + File.separator + "..."}; } @Override public boolean isSourceFolderRequired() { return true; } @Override public boolean isEnforcePrintOutput() { return true; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/GolangGetMojo.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.meta.annotation.MustNotContainNull; import com.igormaznitsa.meta.common.utils.Assertions; import com.igormaznitsa.meta.common.utils.GetUtils; import com.igormaznitsa.mvngolang.cvs.CVSType; import com.igormaznitsa.mvngolang.utils.MavenUtils; import com.igormaznitsa.mvngolang.utils.PackageList; import com.igormaznitsa.mvngolang.utils.ProxySettings; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import org.codehaus.plexus.interpolation.*; import org.zeroturnaround.exec.InvalidExitValueException; import org.zeroturnaround.exec.ProcessExecutor; import org.zeroturnaround.exec.ProcessResult; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.File; import java.io.IOException; import java.net.URI; import java.text.ParseException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * The Mojo wraps the 'get' command. */ @Mojo(name = "get", defaultPhase = LifecyclePhase.INITIALIZE, threadSafe = true, requiresDependencyResolution = ResolutionScope.NONE) public class GolangGetMojo extends AbstractModuleAware { private static final Pattern PATTERN_NO_SUBMODULE_MAPPING_FOUND_IN_GIT = Pattern.compile( "no\\s+submodule\\s+mapping\\s+found\\s+in\\s+.gitmodules for path\\s+\\'([\\S]+?)\\'", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); private static final Pattern PATTERN_EXTRACT_PACKAGE_AND_STATUS = Pattern .compile("^package ([\\S]+?)\\s*:\\s*exit\\s+status\\s+([\\d]+?)\\s*$", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); /** * Script to be called in the end of all operations over CVS, it will be * executed separately for each package. The Script will be started with * the package CVS root folder. During start there will be added number of * environment variables: MVNGO_CVS_BRANCH, MVNGO_CVS_TAG, MVNGO_CVS_REVISION, * MVNGO_CVS_PACKAGE * * @since 2.1.8 */ @Parameter(name = "customScript") private CustomScript customScript; /** * Path to a file contains list of packages. Each package takes a line and * described in format 'package: NAME [,branch: BRANCH][,tag: TAG][,revision: * REVISION]' *

* There is special field value 'none' which allows to define value but to not * make any work, sometime it is useful for multi-profile projects. *

* NB! Its value can be provided through property * 'mvn.golang.get.packages.file', but keep in mind that the value will be the * same for all get goals. * * @since 2.1.9 */ @Parameter(name = "externalPackageFile") private String externalPackageFile; /** * Flag to try to fix GIT cache error if it is detected. * * @since 1.0 */ @Parameter(name = "autofixGitCache", defaultValue = "false") private boolean autofixGitCache; /** * Branch to be activated. * * @since 2.1.0 */ @Parameter(name = "branch") private String branch; /** * Tag to be activated. * * @since 2.1.0 */ @Parameter(name = "tag") private String tag; /** * Revision to be activated. * * @since 2.1.1 */ @Parameter(name = "revision") private String revision; /** * Allows to define custom options for CVS operation. * * @since 2.1.5 */ @Parameter(name = "customCvsOptions") private String[] customCvsOptions; /** * Custom executable CVS file to be executed for branch, tag and revision * operations. * * @since 2.1.1 */ @Parameter(name = "cvsExe") private String cvsExe; /** * Search sources for package and its compiled version, enforce delete of * found source folder and compiled '.a' file. * * @since 2.1.4 */ @Parameter(name = "enforceDeletePackageFiles", defaultValue = "false") private boolean enforceDeletePackageFiles; /** * Delete whole common pkg folder at $GOPATH/pkg. * * @since 2.1.6 */ @Parameter(name = "deleteCommonPkg", defaultValue = "false") private boolean deleteCommonPkg; /** * Allows directly define relative path to the package containing CVS data * inside 'src' folder for package, by default the folder is the same as * package. * * @since 2.1.5 */ @Parameter(name = "relativePathToCvsFolder") private String relativePathToCvsFolder; /** * Disable auto-search for CVS folder in package folder hierarchy, it works * only if CVS folder is not defined directly. * * @since 2.1.5 */ @Parameter(name = "disableCvsAutosearch", defaultValue = "false") private boolean disableCvsAutosearch; /** * Allow lock maven session during command processing. It increases stability of work in parallel mode. * * @since 2.3.3 */ @Parameter(name = "allowLockSession", defaultValue = "true") private boolean allowLockSession; private List integralPackageList; @Nonnull private static String processSlashes(@Nonnull final String str) { final StringBuilder result = new StringBuilder(); boolean check = true; for (final char c : str.toCharArray()) { if (check) { if (c == '\\' || c == '/') { continue; } else { check = false; } } if (c == '\\' || c == '/') { result.append(File.separatorChar); } else { result.append(c); } } while (result.length() > 0) { final char last = result.charAt(result.length() - 1); if (last == '/' || last == '\\') { result.deleteCharAt(result.length() - 1); } else { break; } } return result.toString(); } public boolean isAllowLockSession() { return this.allowLockSession; } public void setAllowLockSession(final boolean flag) { this.allowLockSession = flag; } @Nullable public String getExternalPackageFile() { return findMvnProperty("mvn.golang.get.packages.file", this.externalPackageFile); } @Override @Nonnull @MustNotContainNull public String[] getPackages() { final String[] result = new String[this.integralPackageList.size()]; for (int i = 0; i < this.integralPackageList.size(); i++) { result[i] = this.integralPackageList.get(i).getPackage(); } return result; } @Nullable public CustomScript getCustomScript() { return this.customScript; } private synchronized boolean processCVS( @Nonnull @MustNotContainNull final List packages, @Nullable final ProxySettings proxySettings, @Nonnull @MustNotContainNull final File[] goPath) { if (!packages.isEmpty()) { for (final File f : goPath) { for (final PackageList.Package p : packages) { File rootCvsFolder = this.makePathToPackageSources(f, p.getPackage()); if (this.getRelativePathToCvsFolder() == null) { rootCvsFolder = this.isDisableCvsAutoSearch() ? rootCvsFolder : this.findRootCvsFolderForPackageSources(f, rootCvsFolder); } if (rootCvsFolder == null) { getLog().error( "Can't find CVS folder, may be it was not initially loaded from repository: " + p); return false; } if (this.getLog().isDebugEnabled()) { this.getLog().debug(String.format("CVS folder path for %s is %s", p, rootCvsFolder)); } if (!rootCvsFolder.isDirectory()) { this.getLog().error(String.format("Can't find CVS folder for package '%s' at '%s'", p, rootCvsFolder.getAbsolutePath())); return false; } else { final CVSType repo = CVSType.investigateFolder(rootCvsFolder); if (repo == CVSType.UNKNOWN) { this.getLog().error( "Can't recognize CVS in the folder : " + rootCvsFolder + " (for package '" + p + "')"); this.getLog().error( "May be to define folder directly through ...!"); return false; } final String[] customcvs = this.getCustomCvsOptions(); if (customcvs != null || p.doesNeedCvsProcessing()) { if (!repo.getProcessor() .prepareFolder(this.getLog(), proxySettings, this.getCvsExe(), rootCvsFolder)) { this.getLog().debug("Can't prepare folder : " + rootCvsFolder); return false; } if (customcvs != null && p.doesNeedCvsProcessing()) { this.getLog().warn( "CVS branch, tag or revision are ignored for provided custom CVS options!"); } if (customcvs != null) { this.getLog().info("Custom CVS options : " + Arrays.toString(customcvs)); if (!repo.getProcessor() .processCVSForCustomOptions(this.getLog(), proxySettings, rootCvsFolder, this.getCvsExe(), customcvs)) { return false; } } else if (p.doesNeedCvsProcessing()) { this.getLog().info(String .format("Switch '%s' to branch = '%s', tag = '%s', revision = '%s'", p, GetUtils.ensureNonNull(p.getBranch(), "_"), GetUtils.ensureNonNull(p.getTag(), "_"), GetUtils.ensureNonNull(p.getRevision(), "_"))); if (!repo.getProcessor() .processCVSRequisites(this.getLog(), proxySettings, this.getCvsExe(), rootCvsFolder, p.getBranch(), p.getTag(), p.getRevision())) { return false; } } } } if (this.getCustomScript() != null) { if (!processCustomScriptCallForPackage(p.getPackage(), rootCvsFolder, Assertions.assertNotNull(this.getCustomScript()))) { return false; } } } } } return true; } private boolean processCustomScriptCallForPackage(@Nonnull final String packageName, @Nonnull final File rootCvsFolder, @Nonnull final CustomScript script) { final List command = new ArrayList<>(); command.add(script.path); if (script.options != null) { command.addAll(Arrays.asList(script.options)); } if (getLog().isDebugEnabled()) { getLog().debug("CLI : " + command); getLog().debug("Package name : " + packageName); getLog().debug("Root CVS folder : " + rootCvsFolder); } getLog().warn(String.format("Starting script in VCS folder [%s] : %s", packageName, StringUtils.join(command.toArray(), ' '))); final ProcessExecutor processExecutor = new ProcessExecutor(command.toArray(new String[0])); processExecutor .exitValueAny() .directory(rootCvsFolder) .environment("MVNGO_CVS_BRANCH", GetUtils.ensureNonNull(this.branch, "")) .environment("MVNGO_CVS_TAG", GetUtils.ensureNonNull(this.tag, "")) .environment("MVNGO_CVS_REVISION", GetUtils.ensureNonNull(this.revision, "")) .environment("MVNGO_CVS_PACKAGE", packageName) .redirectError(System.err) .redirectOutput(System.out); boolean result = false; try { final ProcessResult process = processExecutor.executeNoTimeout(); final int exitValue = process.getExitValue(); result = script.ignoreFail || exitValue == 0; } catch (IOException | InterruptedException | InvalidExitValueException ex) { getLog().error("Error in custom script processing", ex); } return result; } public boolean isDisableCvsAutoSearch() { return this.disableCvsAutosearch; } public boolean getDeleteCommonPkg() { return this.deleteCommonPkg; } @Nullable @Override protected String getSkipMojoPropertySuffix() { return "get"; } @Override public boolean isSkip() { return super.isSkip() || Boolean.parseBoolean( MavenUtils.findProperty(this.getSession(), this.getProject(), "mdep.skip", "false")); } @Nullable @MustNotContainNull public String[] getCustomCvsOptions() { return this.customCvsOptions; } @Nullable public String getRelativePathToCvsFolder() { return this.relativePathToCvsFolder; } public boolean isAutoFixGitCache() { return this.autofixGitCache; } public boolean isEnforceDeletePackageFiles() { return this.enforceDeletePackageFiles; } @Nullable public String getRevision() { return this.revision; } @Nullable public String getBranch() { return this.branch; } @Nullable public String getTag() { return this.tag; } @Nullable public String getCvsExe() { return this.cvsExe; } @Override @Nonnull public String getGoCommand() { return "get"; } @Override public boolean isEnforcePrintOutput() { return true; } @Override public boolean isMojoMustNotBeExecuted() throws MojoFailureException { final String[] packages = getTailArguments(); final boolean result; if (packages.length == 0) { getLog().info("There are no packages directly provided as tail arguments"); result = true; } else { result = super.isMojoMustNotBeExecuted(); } return result; } @Nonnull @MustNotContainNull private List extractProblemPackagesFromErrorLog(@Nonnull final String errorLog) { final List result = new ArrayList<>(); final Matcher extractor = PATTERN_EXTRACT_PACKAGE_AND_STATUS.matcher(errorLog); while (extractor.find()) { final String packageName = extractor.group(1); final String status = extractor.group(2); if (!"0".equals(status)) { result.add(packageName); } } return result; } @Nullable private File findRootCvsFolderForPackageSources(@Nonnull final File rootFolder, @Nullable final File packageSourceFolder) { File foundFile = null; if (packageSourceFolder != null) { final File srcFolder = getSrcFolder(rootFolder); File current = packageSourceFolder; while (!srcFolder.equals(current)) { if (CVSType.investigateFolder(current) != CVSType.UNKNOWN) { foundFile = current; break; } current = current.getParentFile(); } } return foundFile; } @Nonnull private File getSrcFolder(@Nonnull final File goPath) { return new File(goPath, "src"); } @Nonnull private File makePathToPackageSources(@Nonnull final File goPath, @Nonnull final String pack) { String path = pack.trim(); final String predefinedCvsPath = getRelativePathToCvsFolder(); if (predefinedCvsPath != null) { path = processSlashes(predefinedCvsPath); } else { try { final URI uri = URI.create(path); path = processSlashes(uri.getPath()); } catch (IllegalArgumentException ex) { // it is not url path = processSlashes(path); } } return new File(getSrcFolder(goPath), path); } @Nonnull private File makePathToPackageCompiled(@Nonnull final File goPath, @Nonnull final String pack) { String path = pack.trim(); try { final URI uri = URI.create(path); path = processSlashes(uri.getPath()); } catch (IllegalArgumentException ex) { // it is not url path = processSlashes(path); } return new File(goPath, "pkg" + File.separatorChar + this.getOs() + '_' + this.getArch() + File.separatorChar + path); } private boolean tryToFixGitCacheErrorsForPackages( @Nonnull @MustNotContainNull final List packages) throws IOException { final File[] goPath = findGoPath(true); int fixed = 0; for (final File f : goPath) { for (final String s : packages) { final File packageFolder = makePathToPackageSources(f, s); if (packageFolder.isDirectory()) { final CVSType repo = CVSType.investigateFolder(packageFolder); if (repo == CVSType.GIT) { getLog().warn(String .format("Executing 'git rm -r --cached .' in %s", packageFolder.getAbsolutePath())); final int result = repo.getProcessor() .execute(getCvsExe(), getLog(), packageFolder, "rm", "-r", "--cached", "."); if (result != 0) { return false; } fixed++; } else { getLog().warn( String.format("Folder %s is not GIT repository", packageFolder.getAbsolutePath())); return false; } fixed++; } else { getLog().debug("Folder " + packageFolder + " is not found"); } } } return fixed != 0; } private void preparePackageList() throws MojoExecutionException { final boolean debugEnabled = getLog().isDebugEnabled(); if (debugEnabled) { getLog().debug("Preparing package list"); } final String[] packagesInConfiguration = super.getPackages(); final List list = new ArrayList<>(); final String extPackageFilePath = this.getExternalPackageFile(); if (extPackageFilePath != null) { if ("none".equals(extPackageFilePath)) { getLog().warn("Provided value 'none' as package list file name, so that it is ignored"); } else { final File extFile = new File(extPackageFilePath); getLog().info("Loading external package list file : " + extFile.getAbsolutePath()); try { String text = FileUtils.readFileToString(extFile, "UTF-8"); if (getLog().isDebugEnabled()) { getLog().debug(text); } text = interpolate(text); list.addAll(new PackageList(extFile, text, new PackageList.ContentProvider() { @Override @Nonnull public String readContent(@Nonnull final File contentFile) throws IOException { if (!contentFile.isFile()) { throw new IOException("Can't find file : " + contentFile.getAbsolutePath()); } try { String text = FileUtils.readFileToString(contentFile, "UTF-8"); if (getLog().isDebugEnabled()) { getLog().debug(text); } return interpolate(text); } catch (InterpolationException ex) { throw new IOException("Can't interpolate text for error", ex); } } }).getPackages()); } catch (InterpolationException ex) { throw new MojoExecutionException("Interpolation error with file : " + extFile, ex); } catch (IOException ex) { throw new MojoExecutionException("Can't load external package list file : " + extFile, ex); } catch (ParseException ex) { throw new MojoExecutionException("Can't parse external package list file", ex); } } } else { if (debugEnabled) { getLog().debug("There is no provided external package list file"); } } if (packagesInConfiguration != null && packagesInConfiguration.length > 0) { for (final String p : packagesInConfiguration) { list.add(new PackageList.Package(p, this.getBranch(), this.getTag(), this.getRevision())); } } else { if (debugEnabled) { getLog().debug("There are no defined packages in mojo configuration"); } } this.integralPackageList = Collections.unmodifiableList(list); if (debugEnabled) { for (final PackageList.Package p : this.integralPackageList) { getLog().debug("Added package in list: " + p.makeString()); } } } @Override protected boolean doesNeedSessionLock() { return this.getSession().isParallel() && this.isAllowLockSession(); } @Override public void beforeExecution(@Nullable final ProxySettings proxySettings) throws MojoFailureException, MojoExecutionException { preparePackageList(); if (getDeleteCommonPkg()) { getLog().warn("Request to delete whole common pkg folder"); final File[] goPath; try { goPath = findGoPath(true); } catch (IOException ex) { throw new MojoExecutionException("Can't get $GOPATH", ex); } for (final File f : goPath) { final File pkgBinary = new File(f, "pkg"); if (pkgBinary.isDirectory()) { try { FileUtils.deleteDirectory(pkgBinary); getLog().warn("Folder " + pkgBinary + " has been deleted"); } catch (IOException ex) { throw new MojoExecutionException("Can't delete PKG folder : " + pkgBinary, ex); } } else { getLog().info("PKG folder is not found : " + pkgBinary); } } } if (isEnforceDeletePackageFiles()) { int deletedInstances = 0; getLog().debug( "Detected request to delete both package source and binary folders if they are presented"); final String[] packages = this.getPackages(); final File[] goPath; try { goPath = findGoPath(true); } catch (IOException ex) { throw new MojoExecutionException("Can't find $GOPATH", ex); } if (packages != null) { for (final File f : goPath) { for (final String p : packages) { getLog().info("Removing binary and source folders for package '" + p + "' in " + f); final File pkgSources = this.makePathToPackageSources(f, p); final File pkgBinary = this.makePathToPackageCompiled(f, p); getLog().debug("Src folder : " + pkgSources); getLog().debug("Pkg folder : " + pkgBinary); if (pkgSources.isDirectory()) { try { FileUtils.deleteDirectory(pkgSources); deletedInstances++; } catch (IOException ex) { throw new MojoExecutionException("Can't delete source folder : " + pkgSources, ex); } getLog().info("\tDeleted source folder : " + pkgSources); } else { getLog().debug("Folder " + pkgSources + " is not found"); } if (pkgBinary.isDirectory()) { try { FileUtils.deleteDirectory(pkgBinary); deletedInstances++; } catch (IOException ex) { throw new MojoExecutionException("Can't delete binary folder : " + pkgBinary, ex); } getLog().info("\tDeleted binary folder : " + pkgBinary); } else { final File compiled = new File(pkgBinary.getAbsolutePath() + ".a"); if (compiled.isFile()) { if (!compiled.delete()) { throw new MojoExecutionException("Can't delete compiled file : " + compiled); } deletedInstances++; getLog().info("\tDeleted compiled file : " + compiled); } else { getLog().debug("File " + compiled + " is not found"); } } } } } if (deletedInstances > 0) { try { getLog().info("making 1.5 second delay to provide time for host-OS to analyze file time stamp"); Thread.sleep(1500L); } catch (InterruptedException ex) { throw new MojoExecutionException("Interrupted"); } } } final String[] customCvs = this.getCustomCvsOptions(); boolean hasTagBranchOrRevision = false; final List packages = Assertions .assertNotNull("Integral package list must be not initialized", this.integralPackageList); for (final PackageList.Package p : packages) { hasTagBranchOrRevision |= p.doesNeedCvsProcessing(); if (hasTagBranchOrRevision) { break; } } if (customCvs != null || hasTagBranchOrRevision) { final File[] goPath; try { goPath = findGoPath(true); } catch (IOException ex) { throw new MojoFailureException("Can't find $GOPATH", ex); } getLog().info("(!) Get initial version of package repository before CVS operations"); this.buildFlagsToIgnore.add("-u"); this.addTmpBuildFlagIfNotPresented("-d"); try { final boolean error = this.doMainBusiness(proxySettings, 10); if (error) { throw new Exception( "error as result of 'get' operation during initial loading of packages " + Arrays.toString(this.getPackages())); } } catch (Exception ex) { throw new MojoExecutionException("Can't get packages", ex); } finally { this.buildFlagsToIgnore.clear(); this.tempBuildFlags.clear(); } getLog().debug(String.format("Switching branch and tag for packages : branch = %s , tag = %s", GetUtils.ensureNonNull(this.branch, "..."), GetUtils.ensureNonNull(this.tag, "..."))); getLog().debug("Custom CVS options : " + Arrays.toString(customCvsOptions)); if (!processCVS(packages, proxySettings, goPath)) { throw new MojoFailureException( "Can't change branch or tag or execute custom CVS options, see the log for errors!"); } } } @Nonnull private String interpolate(@Nonnull final String str) throws IOException, InterpolationException { Interpolator interpolator = new StringSearchInterpolator(); interpolator.addValueSource(new MapBasedValueSource(this.getProject().getProperties())); interpolator.addValueSource(new MapBasedValueSource(System.getProperties())); interpolator.addValueSource(new EnvarBasedValueSource()); return interpolator.interpolate(str); } @Override public boolean isCommandSupportVerbose() { return true; } @Override protected boolean doesNeedOneMoreAttempt(@Nonnull final ProcessResult processResult, @Nonnull final String consoleOut, @Nonnull final String consoleErr) throws IOException, MojoExecutionException { boolean result = false; if (processResult.getExitValue() != 0) { final Matcher matcher = PATTERN_NO_SUBMODULE_MAPPING_FOUND_IN_GIT.matcher(consoleErr); if (matcher.find()) { final List packagesWithDetectedGitCacheErrors = extractProblemPackagesFromErrorLog(consoleErr); if (!packagesWithDetectedGitCacheErrors.isEmpty()) { if (this.autofixGitCache) { getLog().warn("Trying to fix the detected git cache errors automatically.."); result = tryToFixGitCacheErrorsForPackages(packagesWithDetectedGitCacheErrors); } else { for (final String s : packagesWithDetectedGitCacheErrors) { getLog().error(String.format( "Detected Git cache error for package '%s', can be fixed with 'git rm -r --cached .'", s)); } } } } } return result; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/GolangInstallMojo.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.mvngolang.utils.MavenUtils; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.ResolutionScope; import javax.annotation.Nonnull; import javax.annotation.Nullable; /** * The Mojo wraps the 'install' command. */ @Mojo(name = "install", defaultPhase = LifecyclePhase.DEPLOY, threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE) public class GolangInstallMojo extends AbstractModuleAware { @Nullable @Override protected String getSkipMojoPropertySuffix() { return "install"; } @Override public boolean isSkip() { return super.isSkip() || Boolean.parseBoolean(MavenUtils .findProperty(this.getSession(), this.getProject(), "maven.deploy.skip", "false")); } @Override @Nonnull public String getGoCommand() { return "install"; } @Override public boolean isSourceFolderRequired() { return true; } @Override public boolean isEnforcePrintOutput() { return true; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/GolangJfrogCliMojo.java ================================================ /* * Copyright 2019 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.meta.annotation.MustNotContainNull; import com.igormaznitsa.mvngolang.utils.ProxySettings; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.commons.lang3.NotImplementedException; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.zeroturnaround.exec.ProcessExecutor; /** * Minimalistic mojo provides way to call external JFrog CLI executable tool * with environment provided by the Golang wrapper and wrapped GoSDK.JFrog * CLI tool must be provided externally! * JFrog CLI executable file can be downloaded from * the web page * Documentation of the JFrog CLI can be found * here. * * @since 2.3.0 */ @Mojo(name = "jfrog-cli", defaultPhase = LifecyclePhase.NONE, threadSafe = true) public class GolangJfrogCliMojo extends AbstractGoDependencyAwareMojo { /** * Path to a JFrog CLI executable file. Must be defined. */ @Parameter(name = "cliPath", required = true) private String cliPath; /** * The product on which you wish to execute the command: *

    *
  • rt- JFrog Artifactory
  • *
  • bt- JFrog Bintray
  • *
  • mc- JFrog Mission Control
  • *
  • xr- JFrog Xray
  • *
*/ @Parameter(name = "target", defaultValue = "rt") private String target = "rt"; /** * The command to execute. Note that you can use either the full command name * or its abbreviation. */ @Parameter(name = "command", defaultValue = "go") private String command = "go"; /** * A set of arguments corresponding to the command. */ @Parameter(name = "arguments") private List arguments = new ArrayList<>(); @Nonnull @MustNotContainNull public List getArguments() { return this.arguments; } @Nonnull public String getCliPath() { return this.cliPath; } @Nonnull public String getTarget() { return this.target; } @Nonnull public String getCommand() { return this.command; } @Nullable @Override protected String getSkipMojoPropertySuffix() { return "jfrog"; } @Nonnull @Override protected ProcessExecutor prepareExecutor(@Nullable final ProxySettings proxySettings) throws IOException, MojoFailureException, MojoExecutionException { this.initConsoleBuffers(); final File goRoot = this.findGoRoot(proxySettings); final String gobin = this.getGoBin(); final String gocache = this.getGoCache(); final File[] gopathParts = findGoPath(true); final List cliList = new ArrayList<>(); cliList.add(this.getCliPath()); cliList.add(this.getTarget()); cliList.add(this.getCommand()); this.getLog().info("JFrog CLI: " + this.getCliPath()); this.getLog().info(" Target: " + this.getTarget()); this.getLog().info(" Command: " + this.getCommand()); cliList.addAll(this.getArguments()); this.getLog().debug("Prepared CLI: " + cliList); final ProcessExecutor result = new ProcessExecutor(cliList); final File sourcesFile = getSources(isSourceFolderRequired()); logOptionally("GoLang project sources folder : " + sourcesFile); if (sourcesFile.isDirectory()) { result.directory(sourcesFile); } this.registerEnvVars(result, goRoot, gobin, gocache, sourcesFile, gopathParts); this.registerOutputBuffers(result); return result; } @Nonnull @MustNotContainNull @Override public String[] getTailArguments() { throw new NotImplementedException("Must not be called"); } @Nonnull @Override public String getGoCommand() { throw new NotImplementedException("Must not be called"); } @Nonnull @MustNotContainNull @Override public String[] getCommandFlags() { throw new NotImplementedException("Must not be called"); } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/GolangListMojo.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.meta.annotation.MustNotContainNull; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * The Mojo wraps the 'list' command. * * @since 2.3.8 */ @Mojo(name = "list", defaultPhase = LifecyclePhase.PROCESS_SOURCES, threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE) public class GolangListMojo extends AbstractModuleAware { /** * Alternate format for the list, using the syntax of package template. */ @Parameter(name = "format") private String format = null; /** * The flag causes the package data to be printed in JSON format instead of using the template format. */ @Parameter(name = "json") private boolean json; /** * The flag causes list to list modules instead of packages. */ @Parameter(name = "listModules") private boolean listModules; public boolean isListModules() { return this.listModules; } public boolean isJson() { return this.json; } @Nonnull @MustNotContainNull @Override protected String[] getAdditionalCommandFlags() { final List result = new ArrayList<>(); Collections.addAll(result, super.getAdditionalCommandFlags()); if (this.getFormat() != null && this.getFormat().trim().length() != 0) { if (result.contains("-f")) { this.getLog().warn("Format ignored because detected already defined '-f' option"); } else { result.add("-f"); result.add(this.getFormat().trim()); } } if (this.isJson()) { if (result.contains("-f")) { this.getLog().warn("Since GoSDK 1.17, options '-f' and '-json' can't be presented together in the same time"); } if (result.contains("-json")) { this.getLog().warn("Json flag ignored because detected already defined '-json' option"); } else { result.add("-json"); } } if (this.isListModules()) { if (result.contains("-m")) { this.getLog().warn("Module flag ignored because detected already defined '-m' option"); } else { result.add("-m"); } } return result.toArray(new String[0]); } @Nullable public String getFormat() { return this.format; } @Nullable @Override protected String getSkipMojoPropertySuffix() { return "list"; } @Override @Nonnull public String getGoCommand() { return "list"; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/GolangModMojo.java ================================================ /* * Copyright 2019 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.meta.annotation.MustNotContainNull; import com.igormaznitsa.meta.common.utils.Assertions; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import javax.annotation.Nonnull; import javax.annotation.Nullable; /** * The Mojo wraps the 'mod' command. * * @since 2.3.3 */ @Mojo(name = "mod", defaultPhase = LifecyclePhase.NONE, threadSafe = true, requiresDependencyResolution = ResolutionScope.NONE) public class GolangModMojo extends AbstractModuleAware { /** * Command to be executed. Must be defined. */ @Parameter(name = "command", required = true) private String command; /** * Arguments for the command. */ @Parameter(name = "arguments") private String[] arguments; @Override protected boolean doesNeedSessionLock() { return this.getSession().isParallel(); } @Override public boolean isModuleMode() { return true; } @Nonnull @MustNotContainNull @Override protected String[] getAdditionalCommandFlags() { return new String[] {Assertions.assertNotNull(this.command)}; } @Nonnull @MustNotContainNull @Override public String[] getTailArguments() { return this.arguments == null ? new String[0] : this.arguments; } @Nonnull public String getCommand() { return this.command; } public void setCommand(@Nonnull final String value) { this.command = value; } @Override @Nonnull public String getGoCommand() { return "mod"; } @Nullable @Override protected String getSkipMojoPropertySuffix() { return "mod"; } @Override public boolean isEnforcePrintOutput() { return true; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/GolangMvnInstallMojo.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.meta.annotation.MustNotContainNull; import com.igormaznitsa.mvngolang.utils.MavenUtils; import com.igormaznitsa.mvngolang.utils.ProxySettings; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.NotImplementedException; import org.apache.maven.artifact.Artifact; import org.apache.maven.model.Model; import org.apache.maven.model.Resource; import org.apache.maven.model.io.xpp3.MavenXpp3Writer; import org.apache.maven.plugins.annotations.*; import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProjectHelper; import org.apache.maven.shared.transfer.artifact.install.ArtifactInstaller; import org.apache.maven.shared.transfer.repository.RepositoryManager; import org.zeroturnaround.zip.ZipUtil; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.*; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Set; import static com.igormaznitsa.mvngolang.utils.IOUtils.closeSilently; /** * The Mojo packs all found source and resource project folders and create new * artifact in the local repository. * * @since 2.1.0 */ @Mojo(name = "mvninstall", defaultPhase = LifecyclePhase.INSTALL, threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE) public class GolangMvnInstallMojo extends AbstractGoDependencyAwareMojo { /** * Special file contains list of mvn-golang artifacts which must be resolved * and used in build. * * @since 2.3.0 */ public static final String MVNGOLANG_DEPENDENCIES_FILE = ".mvn-golang-dependencies"; /** * Special file contains list of project source and resource folders which * play role in project build. * * @since 2.3.3 */ public static final String MVNGOLANG_BUILD_FOLDERS_FILE = ".mvn-golang-build-folders"; @Component protected RepositoryManager repositoryManager; @Component protected ArtifactInstaller installer; @Component protected MavenProjectHelper projectHelper; /** * Compression level of zip file. Must be 1..9 * * @since 2.1.0 */ @Parameter(name = "compression", defaultValue = "9") private int compression; public int getCompression() { return this.compression; } public void setCompression(final int level) { this.compression = level; } @Nullable @Override protected String getSkipMojoPropertySuffix() { return "install"; } @Override public boolean isSkip() { return super.isSkip() || Boolean.parseBoolean(MavenUtils .findProperty(this.getSession(), this.getProject(), "maven.install.skip", "false")); } @Override protected boolean doMainBusiness(@Nullable final ProxySettings proxySettings, final int maxAttempts) throws IOException { final File archive = compressProjectFiles(); this.getProject().getArtifact().setFile(archive); return false; } private void safeCopyDirectory(@Nullable final String src, @Nonnull final File dst, @Nullable @MustNotContainNull final List dstList) throws IOException { if (!(src == null || src.isEmpty())) { final File srcFile = new File(src); if (srcFile.isDirectory()) { if (getLog().isDebugEnabled()) { getLog().debug( String.format("Copying %s => %s", srcFile.getAbsolutePath(), dst.getAbsolutePath())); } FileUtils.copyDirectoryToDirectory(srcFile, dst); if (dstList != null) { dstList.add(new File(dst, srcFile.getName())); } } } } private void saveEffectivePom(@Nonnull final File folder) throws IOException { final Model model = this.getProject().getModel(); Writer writer = null; try { writer = new OutputStreamWriter(new FileOutputStream(new File(folder, "pom.xml"), false), StandardCharsets.UTF_8); new MavenXpp3Writer().write(writer, model); if (getLog().isDebugEnabled()) { getLog().debug("Effective pom has been written"); } } finally { closeSilently(writer); } } @Nonnull private File compressProjectFiles() throws IOException { final Artifact artifact = this.getProject().getArtifact(); File buildFolder = new File(this.getProject().getBuild().getDirectory()); if (!buildFolder.isDirectory() && !buildFolder.mkdirs()) { this.getLog().error("Can't create build folder: " + buildFolder); throw new IOException("Can't create build folder: " + buildFolder); } File resultZip = new File(buildFolder, artifact.getArtifactId() + '-' + artifact.getVersion() + '.' + artifact.getType()); if (resultZip.isFile() && !resultZip.delete()) { throw new IOException("Can't delete file : " + resultZip); } final File folderToPack = new File(buildFolder, ".tmp_pack_folder_" + Long.toHexString(System.currentTimeMillis()).toUpperCase(Locale.ENGLISH)); if (folderToPack.isDirectory()) { FileUtils.deleteDirectory(folderToPack); } if (!folderToPack.mkdirs()) { throw new IOException("Can't create temp folder : " + folderToPack); } final File mvnGolangDependencyListFile = new File(folderToPack, MVNGOLANG_DEPENDENCIES_FILE); final File mvnGolangBuildFolderListFile = new File(folderToPack, MVNGOLANG_BUILD_FOLDERS_FILE); try { saveEffectivePom(folderToPack); final List buildFolders = new ArrayList<>(); FileUtils.copyFileToDirectory(this.getProject().getFile(), folderToPack); safeCopyDirectory(this.getProject().getBuild().getTestSourceDirectory(), folderToPack, null); for (final Resource res : this.getProject().getBuild().getTestResources()) { safeCopyDirectory(res.getDirectory(), folderToPack, null); } for (final Resource res : this.getProject().getBuild().getResources()) { safeCopyDirectory(res.getDirectory(), folderToPack, buildFolders); } safeCopyDirectory(this.getSources(false).getAbsolutePath(), folderToPack, buildFolders); if (getLog().isDebugEnabled()) { getLog().debug(String.format("Packing folder %s to %s", folderToPack.getAbsolutePath(), resultZip.getAbsolutePath())); } if (mvnGolangBuildFolderListFile.isFile()) { this.getLog().warn( "Skip build source folder list descriptor create because detected existing one: " + MVNGOLANG_BUILD_FOLDERS_FILE); } else { if (buildFolders.isEmpty()) { this.getLog().warn( "Skip build source folder list descriptor because there is not either source or resource folder for build"); } else { final String rooPath = FilenameUtils .separatorsToUnix(FilenameUtils.normalize(folderToPack.getAbsolutePath())); final StringBuilder buffer = new StringBuilder(); for (final File f : buildFolders) { String relativePath = FilenameUtils.separatorsToUnix(FilenameUtils.normalize(f.getAbsolutePath())) .substring(rooPath.length() + 1); if (buffer.length() > 0) { buffer.append('\n'); } this.getLog().debug("Add build folder into descriptor: " + relativePath); buffer.append(relativePath); } final String fileContent = buffer.toString(); this.getLog().debug( "Formed list of mvn-golang project source and resource build folders\n---------" + fileContent + "---------"); FileUtils .writeStringToFile(mvnGolangBuildFolderListFile, fileContent, StandardCharsets.UTF_8); } } if (mvnGolangDependencyListFile.isFile()) { this.getLog().warn("Skip dependency descriptor create because detected existing one: " + MVNGOLANG_DEPENDENCIES_FILE); } else { final List golangDependencies = new ArrayList<>(); MavenProject currentProject = this.getProject(); while (currentProject != null && !Thread.currentThread().isInterrupted()) { final Set dependencies = currentProject.getDependencyArtifacts(); if (dependencies != null) { for (final Artifact a : dependencies) { if (AbstractGolangMojo.GOARTIFACT_PACKAGING.equals(a.getType())) { golangDependencies.add(a); } } } currentProject = currentProject.getParent(); } final StringBuilder buffer = new StringBuilder(); for (final Artifact a : golangDependencies) { buffer.append(MavenUtils.makeArtifactRecord(a)).append('\n'); } final String flagFileContent = buffer.toString(); this.getLog().debug( "Formed list of mvn-golang dependencies\n---------" + flagFileContent + "---------"); FileUtils.writeStringToFile(mvnGolangDependencyListFile, flagFileContent, StandardCharsets.UTF_8); } this.getLog().debug("Restoring all backup go.mod in prepared folder to pack"); restoreAllBackupGoMod(folderToPack); ZipUtil.pack(folderToPack, resultZip, Math.min(9, Math.max(1, this.compression))); } finally { FileUtils.deleteQuietly(folderToPack); } return resultZip; } private void restoreAllBackupGoMod(@Nonnull final File folder) throws IOException { final File backup = new File(folder, GO_MOD_FILE_NAME_BAK); if (backup.isFile()) { final File gomod = new File(folder, GO_MOD_FILE_NAME); if (gomod.isFile() && !gomod.delete()) { throw new IOException("Can't delete " + gomod); } if (!backup.renameTo(gomod)) { throw new IOException("Can't rename " + backup); } } final File[] foundFiles = folder.listFiles( pathname -> pathname.isDirectory() && !Files.isSymbolicLink(pathname.toPath())); if (foundFiles != null) { for (final File f : foundFiles) { restoreAllBackupGoMod(f); } } } @Nonnull @MustNotContainNull @Override public String[] getTailArguments() { throw new NotImplementedException("Must not be called"); } @Nonnull @Override public String getGoCommand() { throw new NotImplementedException("Must not be called"); } @Nonnull @MustNotContainNull @Override public String[] getCommandFlags() { throw new NotImplementedException("Must not be called"); } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/GolangRunMojo.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.meta.annotation.MustNotContainNull; import com.igormaznitsa.meta.common.utils.ArrayUtils; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * The Mojo allows to run a program, it wraps run command. * * @since 2.0.0 */ @SuppressWarnings("SpellCheckingInspection") @Mojo(name = "run", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) public class GolangRunMojo extends AbstractModuleAware { /** * If the parameter is defined then -exec will be used with the parameter value. * * @since 2.0.0 */ @Parameter(name = "xprog") private String xprog; /** * Command arguments. They follow package names in command line. * * @since 2.1.7 */ @Parameter(name = "args") private String[] args; /** * Get command line arguments. * * @return array of arguments, must not be null * @since 2.1.7 */ @Nonnull @MustNotContainNull public String[] getArgs() { return this.args == null ? ArrayUtils.EMPTY_STRING_ARRAY : this.args.clone(); } @Override @Nonnull @MustNotContainNull public String[] getTailArguments() { final List result = new ArrayList<>(Arrays.asList(super.getTailArguments())); result.addAll(Arrays.asList(this.getArgs())); return result.toArray(new String[0]); } @Override public boolean isSourceFolderRequired() { return true; } @Override @Nonnull @MustNotContainNull protected String[] getExtraBuildFlags() { String[] result = ArrayUtils.EMPTY_STRING_ARRAY; if (this.xprog != null) { result = new String[] {"-exec", this.xprog}; } return result; } @Nullable @Override protected String getSkipMojoPropertySuffix() { return "run"; } @Override @Nonnull public String getGoCommand() { return "run"; } @Override public boolean isEnforcePrintOutput() { return true; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/GolangTestMojo.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.meta.annotation.MustNotContainNull; import com.igormaznitsa.meta.common.utils.ArrayUtils; import com.igormaznitsa.meta.common.utils.GetUtils; import com.igormaznitsa.mvngolang.utils.MavenUtils; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.File; import java.util.ArrayList; import java.util.List; /** * The Mojo wraps the 'test' command. */ @Mojo(name = "test", defaultPhase = LifecyclePhase.TEST, threadSafe = true, requiresDependencyResolution = ResolutionScope.TEST) public class GolangTestMojo extends AbstractModuleAware { /** * List of test binary flags. */ @Parameter(name = "testFlags") private String[] testFlags; @Nonnull private String ensureGoExtension(@Nonnull final String name) { return name.endsWith(".go") ? name : name + ".go"; } @Nullable @Override protected String getSkipMojoPropertySuffix() { return "test"; } @Override public boolean isSkip() { return super.isSkip() || Boolean.getBoolean("skipTests") || Boolean.parseBoolean( MavenUtils.findProperty(this.getSession(), this.getProject(), "maven.test.skip", "false")); } @Override @Nullable @MustNotContainNull protected String[] getDefaultPackages() { final String definedTest = System.getProperty("test"); if (definedTest != null) { final int index = definedTest.indexOf('#'); final String[] name; if (index >= 0) { name = new String[] {definedTest.substring(0, index), definedTest.substring(index + 1)}; } else { name = new String[] {definedTest}; } final List result = new ArrayList<>(); result.add(ensureGoExtension(name[0])); if (definedTest.length() > 1) { result.add("-run"); result.add(name[1]); } return result.toArray(new String[0]); } else { return new String[] {'.' + File.separator + "..."}; } } @Override public boolean isIgnoreErrorExitCode() { return Boolean.parseBoolean(MavenUtils .findProperty(this.getSession(), this.getProject(), "maven.test.failure.ignore", "false")) || super.isIgnoreErrorExitCode(); } @Nullable @MustNotContainNull public String[] getTestFlags() { return this.testFlags == null ? null : this.testFlags.clone(); } @Override public boolean isSourceFolderRequired() { return true; } @Override @Nonnull @MustNotContainNull public String[] getOptionalExtraTailArguments() { return GetUtils.ensureNonNull(this.testFlags, ArrayUtils.EMPTY_STRING_ARRAY); } @Override @Nonnull public String getGoCommand() { return "test"; } @Override public boolean isEnforcePrintOutput() { return true; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/GolangToolMojo.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.meta.annotation.MustNotContainNull; import com.igormaznitsa.meta.common.utils.ArrayUtils; import com.igormaznitsa.meta.common.utils.GetUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; /** * The Mojo wraps the 'tool' command. */ @Mojo(name = "tool", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE) public class GolangToolMojo extends AbstractGoDependencyAwareMojo { /** * The Command to be executed. */ @Parameter(name = "command", required = true) private String command; /** * Command arguments. */ @Parameter(name = "args") private String[] args; @Nullable @MustNotContainNull public String[] getArgs() { return this.args == null ? null : this.args.clone(); } public void setArgs(@Nullable @MustNotContainNull final String[] value) { this.args = value == null ? null : value.clone(); } @Nullable @Override protected String getSkipMojoPropertySuffix() { return "tool"; } @Override @Nonnull @MustNotContainNull public String[] getTailArguments() { final List result = new ArrayList<>(); result.add(this.command); result.addAll(Arrays.asList(GetUtils.ensureNonNull(this.args, ArrayUtils.EMPTY_STRING_ARRAY))); return result.toArray(new String[0]); } @Nonnull public String getCommand() { return this.command; } public void setCommand(@Nullable final String value) { this.command = value; } @Override @Nonnull public String getGoCommand() { return "tool"; } @Override @Nonnull @MustNotContainNull public String[] getCommandFlags() { return ArrayUtils.EMPTY_STRING_ARRAY; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/GolangVetMojo.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.meta.annotation.MustNotContainNull; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.ResolutionScope; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.File; /** * The Mojo wraps the 'vet' command. */ @Mojo(name = "vet", defaultPhase = LifecyclePhase.VERIFY, threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE) public class GolangVetMojo extends AbstractModuleAware { @Override @Nullable @MustNotContainNull protected String[] getDefaultPackages() { return new String[]{'.' + File.separator + "..."}; } @Nullable @Override protected String getSkipMojoPropertySuffix() { return "vet"; } @Override @Nonnull public String getGoCommand() { return "vet"; } @Override public boolean isEnforcePrintOutput() { return true; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/cvs/AbstractRepo.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.cvs; import com.igormaznitsa.meta.annotation.MustNotContainNull; import com.igormaznitsa.meta.common.utils.GetUtils; import com.igormaznitsa.mvngolang.utils.ProxySettings; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.commons.lang3.SystemUtils; import org.apache.maven.plugin.logging.Log; import org.zeroturnaround.exec.InvalidExitValueException; import org.zeroturnaround.exec.ProcessExecutor; import org.zeroturnaround.exec.ProcessResult; public abstract class AbstractRepo { private final String command; public AbstractRepo(@Nonnull final String command) { this.command = SystemUtils.IS_OS_WINDOWS ? command + ".exe" : command; } @Nonnull public String getCommand() { return this.command; } public int execute(@Nullable String customCommand, @Nonnull final Log logger, @Nonnull final File cvsFolder, @Nonnull @MustNotContainNull final String... args) { final List cli = new ArrayList<>(); cli.add(GetUtils.findFirstNonNull(customCommand, this.command)); cli.addAll(Arrays.asList(args)); if (logger.isDebugEnabled()) { logger.debug("Executing repo command : " + cli); } final ByteArrayOutputStream errorStream = new ByteArrayOutputStream(); final ByteArrayOutputStream outStream = new ByteArrayOutputStream(); final ProcessExecutor executor = new ProcessExecutor(cli); int result = -1; try { final ProcessResult processResult = executor.directory(cvsFolder).redirectError(errorStream).redirectOutput(outStream) .executeNoTimeout(); result = processResult.getExitValue(); if (logger.isDebugEnabled()) { logger.debug("Exec.out........................................."); logger.debug(new String(errorStream.toByteArray(), Charset.defaultCharset())); logger.debug("................................................."); } if (result != 0) { logger.error(new String(errorStream.toByteArray(), Charset.defaultCharset())); } } catch (IOException | InterruptedException | InvalidExitValueException ex) { if (ex instanceof InterruptedException) { Thread.currentThread().interrupt(); } logger.error("Unexpected error", ex); } return result; } protected boolean checkResult(@Nonnull final Log logger, final int code) { return code == 0; } public abstract boolean doesContainCVS(@Nonnull File folder); public boolean prepareFolder(@Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nullable final String customExe, @Nonnull final File cvsFolder) { return true; } public boolean processCVSForCustomOptions( @Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nonnull final File cvsFolder, @Nullable final String customCommand, @Nonnull @MustNotContainNull final String... options ) { logger.debug("customCvsCall: " + Arrays.toString(options)); return checkResult(logger, execute(customCommand, logger, cvsFolder, options)); } public abstract boolean processCVSRequisites( @Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nullable final String customCommand, @Nonnull final File cvsFolder, @Nullable final String branchId, @Nullable final String tagId, @Nullable final String revisionId ); } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/cvs/CVSType.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.cvs; import java.io.File; import javax.annotation.Nonnull; import javax.annotation.Nullable; public enum CVSType { UNKNOWN(new CvsNone()), GIT(new CvsGIT()), HG(new CvsHG()), SVN(new CvsSVN()), BAZAAR(new CvsBZR()); private final AbstractRepo processor; CVSType(@Nonnull final AbstractRepo processor) { this.processor = processor; } @Nonnull public static CVSType investigateFolder(@Nullable final File folder) { CVSType result = UNKNOWN; if (folder != null && folder.isDirectory()) { for (final CVSType t : values()) { if (t.getProcessor().doesContainCVS(folder)) { result = t; break; } } } return result; } @Nonnull public AbstractRepo getProcessor() { return this.processor; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/cvs/CvsBZR.java ================================================ /* * Copyright 2017 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.cvs; import com.igormaznitsa.mvngolang.utils.ProxySettings; import java.io.File; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.maven.plugin.logging.Log; public class CvsBZR extends AbstractRepo { public CvsBZR() { super("bzr"); } @Override public boolean doesContainCVS(@Nonnull final File folder) { return new File(folder, ".bzr").isDirectory(); } @Override public boolean processCVSRequisites( @Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nullable final String customCommand, @Nonnull final File cvsFolder, @Nullable final String branchId, @Nullable final String tagId, @Nullable final String revisionId ) { boolean noError = true; if (branchId != null) { noError &= upToBranch(logger, proxy, customCommand, cvsFolder, branchId); } if (noError && tagId != null) { noError &= upToTag(logger, proxy, customCommand, cvsFolder, tagId); } if (noError && revisionId != null) { noError &= upToRevision(logger, proxy, customCommand, cvsFolder, revisionId); } return noError; } private boolean upToBranch(@Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nullable final String customCommand, @Nonnull final File cvsFolder, @Nonnull final String branchId) { logger.debug("upToBranch : " + branchId); return checkResult(logger, execute(customCommand, logger, cvsFolder, "switch", "--force", branchId)); } private boolean upToTag(@Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nullable final String customCommand, @Nonnull final File cvsFolder, @Nonnull final String tagId) { logger.debug("upToTag : " + tagId); return checkResult(logger, execute(customCommand, logger, cvsFolder, "switch", "--force", tagId)); } private boolean upToRevision(@Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nullable final String customCommand, @Nonnull final File cvsFolder, @Nonnull final String revisionId) { logger.debug("upToRevision : " + revisionId); return checkResult(logger, execute(customCommand, logger, cvsFolder, "switch", "--force", "--revision", revisionId)); } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/cvs/CvsGIT.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.cvs; import com.igormaznitsa.mvngolang.utils.ProxySettings; import java.io.File; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.maven.plugin.logging.Log; class CvsGIT extends AbstractRepo { CvsGIT() { super("git"); } @Override public boolean doesContainCVS(@Nonnull final File folder) { return new File(folder, ".git").isDirectory(); } @Override public boolean processCVSRequisites( @Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nullable final String customCommand, @Nonnull final File cvsFolder, @Nullable final String branchId, @Nullable final String tagId, @Nullable final String revisionId ) { boolean notError = true; if (branchId != null) { notError &= upToBranch(logger, proxy, customCommand, cvsFolder, branchId); } if (notError && tagId != null) { if (branchId == null) { notError &= upToBranch(logger, proxy, customCommand, cvsFolder, "master"); } if (notError) { notError &= upToTag(logger, proxy, customCommand, cvsFolder, tagId); } } if (notError && revisionId != null) { notError &= upToRevision(logger, proxy, customCommand, cvsFolder, revisionId); } return notError; } private boolean upToBranch(@Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nullable final String customCommand, @Nonnull final File cvsFolder, @Nonnull final String branchId) { logger.debug("upToBranch: " + branchId); return checkResult(logger, execute(customCommand, logger, cvsFolder, "checkout", "--quiet", "--force", branchId)); } private boolean upToTag(@Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nullable final String customCommand, @Nonnull final File cvsFolder, @Nonnull final String tagId) { logger.debug("upToTag: " + tagId); return checkResult(logger, execute(customCommand, logger, cvsFolder, "checkout", "--quiet", "--force", "tags/" + tagId)); } private boolean upToRevision(@Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nullable final String customCommand, @Nonnull final File cvsFolder, @Nonnull final String revisionId) { logger.debug("upToRevision: " + revisionId); return checkResult(logger, execute(customCommand, logger, cvsFolder, "checkout", "--quiet", "--force", revisionId)); } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/cvs/CvsHG.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.cvs; import com.igormaznitsa.mvngolang.utils.ProxySettings; import java.io.File; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.maven.plugin.logging.Log; class CvsHG extends AbstractRepo { CvsHG() { super("hg"); } @Override public boolean doesContainCVS(@Nonnull final File folder) { return new File(folder, ".hg").isDirectory(); } @Override public boolean processCVSRequisites( @Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nullable final String customCommand, @Nonnull final File cvsFolder, @Nullable final String branchId, @Nullable final String tagId, @Nullable final String revisionId ) { boolean noError = true; if (branchId != null) { noError &= upToBranch(logger, proxy, customCommand, cvsFolder, branchId); } if (noError && tagId != null) { noError &= upToTag(logger, proxy, customCommand, cvsFolder, tagId); } if (noError && revisionId != null) { noError &= upToRevision(logger, proxy, customCommand, cvsFolder, revisionId); } return noError; } private boolean upToBranch(@Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nullable final String customCommand, @Nonnull final File cvsFolder, @Nonnull final String branchId) { logger.debug("upToBranch: " + branchId); return checkResult(logger, execute(customCommand, logger, cvsFolder, "update", "--clean", branchId)); } private boolean upToTag(@Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nullable final String customCommand, @Nonnull final File cvsFolder, @Nonnull final String tagId) { logger.debug("upToTag: " + tagId); return checkResult(logger, execute(customCommand, logger, cvsFolder, "update", "--clean", tagId)); } private boolean upToRevision(@Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nullable final String customCommand, @Nonnull final File cvsFolder, @Nonnull final String revisionId) { logger.debug("upToRevision: " + revisionId); return checkResult(logger, execute(customCommand, logger, cvsFolder, "update", "--clean", "--rev", revisionId)); } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/cvs/CvsNone.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.cvs; import com.igormaznitsa.mvngolang.utils.ProxySettings; import java.io.File; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.maven.plugin.logging.Log; class CvsNone extends AbstractRepo { CvsNone() { super("%%%+++none+++%%%"); } @Override public boolean processCVSRequisites( @Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nullable final String customCommand, @Nonnull final File cvsFolder, @Nullable final String branchId, @Nullable final String tagId, @Nullable final String revisionId ) { return false; } @Override public boolean doesContainCVS(@Nonnull File folder) { return false; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/cvs/CvsSVN.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.cvs; import com.igormaznitsa.mvngolang.utils.ProxySettings; import java.io.File; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.maven.plugin.logging.Log; class CvsSVN extends AbstractRepo { CvsSVN() { super("svn"); } @Override public boolean processCVSRequisites( @Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nullable final String customCommand, @Nonnull final File cvsFolder, @Nullable final String branchId, @Nullable final String tagId, @Nullable final String revisionId ) { boolean noError = true; if (branchId != null) { noError &= upToBranch(logger, proxy, customCommand, cvsFolder, branchId); } if (noError && tagId != null) { noError &= upToTag(logger, proxy, customCommand, cvsFolder, tagId); } if (noError && revisionId != null) { noError &= upToRevision(logger, proxy, customCommand, cvsFolder, revisionId); } return noError; } @Override public boolean doesContainCVS(@Nonnull final File folder) { return new File(folder, ".svn").isDirectory(); } private boolean upToBranch(@Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nullable final String customCommand, @Nonnull final File cvsFolder, @Nonnull final String branchId) { logger.debug("upToBranch : " + branchId); return checkResult(logger, execute(customCommand, logger, cvsFolder, "switch", "--accept", "theirs-full", "--force", branchId)); } private boolean upToTag(@Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nullable final String customCommand, @Nonnull final File cvsFolder, @Nonnull final String tagId) { logger.debug("upToTag : " + tagId); return checkResult(logger, execute(customCommand, logger, cvsFolder, "switch", "--accept", "theirs-full", "--force", tagId)); } private boolean upToRevision(@Nonnull final Log logger, @Nullable final ProxySettings proxy, @Nullable final String customCommand, @Nonnull final File cvsFolder, @Nonnull final String revisionId) { logger.debug("upToRevision : " + revisionId); return checkResult(logger, execute(customCommand, logger, cvsFolder, "switch", "--accept", "theirs-full", "--force", "--revision", revisionId)); } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/utils/GoMod.java ================================================ /* * Copyright 2019 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.utils; import com.igormaznitsa.meta.annotation.MustNotContainNull; import com.igormaznitsa.meta.common.utils.Assertions; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.annotation.Nonnull; import javax.annotation.Nullable; public final class GoMod { private static final Pattern TOKENIZER = Pattern.compile("(\\/\\/|\\\"[^\\\"]+\\\"|[<>=\\w.+\\-/\\\\]+|[<>=-]+|\\(|\\)|[\\s\\n]+)"); private final List items; private GoMod(@Nonnull @MustNotContainNull final List items) { final List newList = new ArrayList<>(items); Collections.sort(newList); this.items = newList; } @Nonnull private static String quoteIfHasSpace(@Nonnull final String str) { return str.contains(" ") ? '\"' + str + '\"' : str; } @Nonnull private static String ensureNoQuoting(@Nonnull final String text) { return text.startsWith("\"") ? text.substring(1, text.length() - 1) : text; } @Nonnull @MustNotContainNull private static List extractModuleInfo( @Nonnull @MustNotContainNull final List tokens, @Nonnull @MustNotContainNull final String... separators) { final List result = new ArrayList<>(); final List tokenBuffer = new ArrayList<>(tokens); final List accum = new ArrayList<>(); while (!tokenBuffer.isEmpty()) { final String next = tokenBuffer.remove(0); boolean separator = false; for (final String s : separators) { if (s.equals(next)) { separator = true; break; } } if (separator) { switch (accum.size()) { case 1: { result.add(new ModuleInfo(accum.remove(0))); } break; case 2: { final String name = accum.remove(0); final String version = accum.remove(0); result.add(new ModuleInfo(name, version)); } break; default: throw new IllegalArgumentException("Can't extract module info from tokens: " + tokens); } } else { accum.add(next); } } switch (accum.size()) { case 1: { result.add(new ModuleInfo(accum.remove(0))); } break; case 2: { final String name = accum.remove(0); final String version = accum.remove(0); result.add(new ModuleInfo(name, version)); } break; default: throw new IllegalArgumentException("Can't extract module info from tokens: " + tokens); } return result; } @Nonnull public static GoMod from(@Nonnull final String str) { final List foundItems = new ArrayList<>(); final Matcher matcher = TOKENIZER.matcher(str); ParserState state = ParserState.FIND; boolean findEol = false; boolean bracket = false; final List tokenList = new ArrayList<>(); String customTokenName = null; while (matcher.find()) { final String token = matcher.group(1); if (findEol) { if (token.contains("\n")) { findEol = false; state = bracket ? state : ParserState.FIND; } } else { switch (state) { case FIND: { tokenList.clear(); switch (token) { case "module": { state = ParserState.MODULE; } break; case "exclude": { state = ParserState.EXCLUDE; } break; case "replace": { state = ParserState.REPLACE; } break; case "require": { state = ParserState.REQUIRE; } break; default: { if ("//".equals(token)) { findEol = true; } else if (!token.trim().isEmpty()) { state = ParserState.CUSTOM; customTokenName = token; } } break; } } break; case CUSTOM: { if ("//".equals(token)) { if (!bracket) { foundItems.add(new GoCustom(customTokenName, tokenList.toArray(new String[0]))); foundItems.clear(); customTokenName = null; state = ParserState.FIND; } } else { if ("(".equals(token)) { if (bracket) { throw new IllegalArgumentException("Duplicated opening bracket in " + state); } bracket = true; } else if (")".equals(token)) { if (!bracket) { throw new IllegalArgumentException("Unexpected closing bracket in " + state); } bracket = false; foundItems.add(new GoCustom(customTokenName, tokenList.toArray(new String[0]))); foundItems.clear(); customTokenName = null; state = ParserState.FIND; } else if (token.contains("\n")) { if (!bracket) { state = ParserState.FIND; foundItems.add(new GoCustom(customTokenName, tokenList.toArray(new String[0]))); } } else { if (!token.trim().isEmpty()) { tokenList.add(token); } } } } break; case MODULE: case EXCLUDE: case REPLACE: case REQUIRE: { if ("(".equals(token)) { if (bracket) { throw new IllegalArgumentException("Duplicated opening bracket in " + state); } if (!tokenList.isEmpty()) { throw new IllegalArgumentException( "Unexpected tokens " + tokenList + " before bracket in " + state); } bracket = true; } else { final boolean processTokenList; ParserState nextState = state; if (")".equals(token)) { if (!bracket) { throw new IllegalArgumentException("Unexpected closing bracket in " + state); } bracket = false; processTokenList = !tokenList.isEmpty(); nextState = ParserState.FIND; } else if ("//".equals(token)) { findEol = true; processTokenList = !bracket || !tokenList.isEmpty(); nextState = bracket ? state : ParserState.FIND; } else if (token.contains("\n")) { processTokenList = !bracket || !tokenList.isEmpty(); nextState = bracket ? state : ParserState.FIND; } else { if (!token.trim().isEmpty()) { tokenList.add(ensureNoQuoting(token)); } processTokenList = false; } if (processTokenList) { switch (state) { case MODULE: { final List moduleInfos = extractModuleInfo(tokenList); tokenList.clear(); while (!moduleInfos.isEmpty()) { foundItems.add(new GoModule(moduleInfos.remove(0))); } } break; case REQUIRE: { final List moduleInfos = extractModuleInfo(tokenList); tokenList.clear(); while (!moduleInfos.isEmpty()) { foundItems.add(new GoRequire(moduleInfos.remove(0))); } } break; case EXCLUDE: { final List moduleInfos = extractModuleInfo(tokenList); tokenList.clear(); while (!moduleInfos.isEmpty()) { foundItems.add(new GoExclude(moduleInfos.remove(0))); } } break; case REPLACE: { final List moduleInfos = extractModuleInfo(tokenList, "=>"); tokenList.clear(); while (!moduleInfos.isEmpty()) { final ModuleInfo from = moduleInfos.remove(0); if (moduleInfos.isEmpty()) { throw new IllegalArgumentException("Can't find target in replace"); } final ModuleInfo to = moduleInfos.remove(0); foundItems.add(new GoReplace(from, to)); } } break; default: throw new Error("Unexpected: " + state); } } state = nextState; } } break; } } } if (!tokenList.isEmpty()) { switch (state) { case MODULE: { final List moduleInfos = extractModuleInfo(tokenList); tokenList.clear(); while (!moduleInfos.isEmpty()) { foundItems.add(new GoModule(moduleInfos.remove(0))); } } break; case REQUIRE: { final List moduleInfos = extractModuleInfo(tokenList); tokenList.clear(); while (!moduleInfos.isEmpty()) { foundItems.add(new GoRequire(moduleInfos.remove(0))); } } break; case EXCLUDE: { final List moduleInfos = extractModuleInfo(tokenList); tokenList.clear(); while (!moduleInfos.isEmpty()) { foundItems.add(new GoExclude(moduleInfos.remove(0))); } } break; case REPLACE: { final List moduleInfos = extractModuleInfo(tokenList, "=>"); tokenList.clear(); while (!moduleInfos.isEmpty()) { final ModuleInfo from = moduleInfos.remove(0); if (moduleInfos.isEmpty()) { throw new IllegalArgumentException("Can't find target in replace"); } final ModuleInfo to = moduleInfos.remove(0); foundItems.add(new GoReplace(from, to)); } } break; case CUSTOM: { foundItems.add(new GoCustom(customTokenName, tokenList.toArray(new String[0]))); } break; default: break; } } return new GoMod(foundItems); } @Override public boolean equals(@Nullable final Object that) { if (that == null) { return false; } if (that == this) { return true; } if (that instanceof GoMod) { final GoMod thatGoMod = (GoMod) that; if (this.items.size() != thatGoMod.items.size()) { return false; } for (int i = 0; i < this.items.size(); i++) { if (!this.items.get(i).equals(thatGoMod.items.get(i))) { return false; } } return true; } return false; } @Override public int hashCode() { return 31; } @Nonnull public GoMod addItem(@Nonnull final GoModItem item) { this.items.add(item); Collections.sort(this.items); return this; } @Nonnull @MustNotContainNull public List find(@Nonnull final Class klass) { final List result = new ArrayList<>(); for (final GoModItem i : this.items) { if (klass == i.getClass()) { result.add(klass.cast(i)); } } return result; } public int size() { return this.items.size(); } @Nonnull @Override public String toString() { final StringBuilder buffer = new StringBuilder(); for (final GoModItem i : this.items) { if (buffer.length() > 0) { buffer.append('\n'); } buffer.append(i.toString()); } return buffer.toString(); } public boolean hasReplaceFor(@Nonnull final String moduleName, @Nullable final String version) { boolean found = false; for (final GoModItem r : this.items) { if (r instanceof GoReplace) { final GoReplace require = (GoReplace) r; if (moduleName.equals(require.getModule().getName()) && (version == null || version.equals(require.getModule().getVersion()))) { found = true; } } } return found; } public boolean hasRequireFor(@Nonnull final String moduleName, @Nullable final String version) { boolean found = false; for (final GoModItem r : this.items) { if (r instanceof GoRequire) { final GoRequire require = (GoRequire) r; if (moduleName.equals(require.getModuleInfo().getName()) && (version == null || version.equals(require.getModuleInfo().getVersion()))) { found = true; } } } return found; } @Nullable public String getModule() { final List found = this.find(GoModule.class); return found.isEmpty() ? null : found.get(0).getModuleInfo().getName(); } private enum ParserState { FIND, MODULE, REQUIRE, REPLACE, EXCLUDE, CUSTOM } public static abstract class GoModItem implements Comparable { @Override public int compareTo(@Nonnull final GoModItem that) { int result = Integer.compare(this.getPriority(), that.getPriority()); if (result == 0) { result = this.toString().compareTo(that.toString()); } return result; } public abstract int getPriority(); @Override public abstract boolean equals(@Nullable Object that); @Override public abstract int hashCode(); } public final static class ModuleInfo { private final String name; private final String version; public ModuleInfo(@Nonnull final String name) { this.name = Assertions.assertNotNull(name); this.version = null; } public ModuleInfo(@Nonnull final String name, @Nullable final String version) { this.name = Assertions.assertNotNull(name); this.version = version; } @Nonnull public String getName() { return this.name; } @Nullable public String getVersion() { return this.version; } @Override public boolean equals(@Nullable final Object that) { if (that == null) { return false; } if (that == this) { return true; } if (that instanceof ModuleInfo) { final ModuleInfo thatModuleInfo = (ModuleInfo) that; return this.name.equals(thatModuleInfo.name) && (Objects.equals(this.version, thatModuleInfo.version)); } return false; } @Override public int hashCode() { return this.name.hashCode() ^ (this.version == null ? 0 : this.version.hashCode()); } @Nonnull @Override public String toString() { return quoteIfHasSpace(this.name) + (this.version == null ? "" : " " + quoteIfHasSpace(this.version)); } } public static final class GoModule extends GoModItem { private final ModuleInfo moduleInfo; public GoModule(@Nonnull final ModuleInfo module) { this.moduleInfo = Assertions.assertNotNull(module); } @Override public boolean equals(@Nullable final Object that) { if (that == null) { return false; } if (that == this) { return true; } if (that instanceof GoModule) { return this.moduleInfo.equals(((GoModule) that).moduleInfo); } return false; } @Override public int hashCode() { return this.moduleInfo.hashCode(); } @Nonnull public ModuleInfo getModuleInfo() { return this.moduleInfo; } @Override @Nonnull public String toString() { return "module " + this.moduleInfo; } @Override public int getPriority() { return 0; } } public static class GoRequire extends GoModItem { private final ModuleInfo moduleInfo; public GoRequire(@Nonnull final ModuleInfo moduleInfo) { this.moduleInfo = Assertions.assertNotNull(moduleInfo); } @Override public boolean equals(@Nullable final Object that) { if (that == null) { return false; } if (that == this) { return true; } if (that instanceof GoRequire) { return this.moduleInfo.equals(((GoRequire) that).moduleInfo); } return false; } @Override public int hashCode() { return this.moduleInfo.hashCode(); } @Nonnull public ModuleInfo getModuleInfo() { return this.moduleInfo; } @Nonnull @Override public String toString() { return "require " + this.moduleInfo; } @Override public int getPriority() { return 1; } } public static final class GoCustom extends GoModItem { private final String name; private final String[] tokens; public GoCustom(@Nonnull final String name, @Nonnull @MustNotContainNull final String[] tokens) { this.name = Assertions.assertNotNull(name); this.tokens = tokens.clone(); } @Override public boolean equals(@Nullable final Object that) { if (that == null) { return false; } if (that == this) { return true; } if (that instanceof GoCustom) { return this.name.equals(((GoCustom) that).name) && Arrays.equals(this.tokens, ((GoCustom) that).tokens); } return false; } @Override public int hashCode() { return this.name.hashCode(); } @Nonnull @Override public String toString() { final StringBuilder result = new StringBuilder(); result.append(name); for (final String t : tokens) { if (")".equals(t)) { result.append('\n'); } result.append(' ').append(quoteIfHasSpace(t)); if ("(".equals(t)) { result.append('\n'); } } return result.toString(); } @Override public int getPriority() { return 100; } } public static final class GoReplace extends GoModItem { private final ModuleInfo module; private final ModuleInfo replacement; public GoReplace(@Nonnull final ModuleInfo module, @Nonnull final ModuleInfo replacement) { this.module = Assertions.assertNotNull(module); this.replacement = Assertions.assertNotNull(replacement); } @Override public boolean equals(@Nullable final Object that) { if (that == null) { return false; } if (that == this) { return true; } if (that instanceof GoReplace) { return this.module.equals(((GoReplace) that).module) && this.replacement.equals(((GoReplace) that).replacement); } return false; } @Override public int hashCode() { return this.module.hashCode() ^ this.replacement.hashCode(); } @Nonnull public ModuleInfo getModule() { return this.module; } @Nonnull public ModuleInfo getReplacement() { return this.replacement; } @Nonnull @Override public String toString() { return "replace " + this.module + " => " + this.replacement; } @Override public int getPriority() { return 2; } } public static final class GoExclude extends GoModItem { private final ModuleInfo module; public GoExclude(@Nonnull final ModuleInfo module) { this.module = Assertions.assertNotNull(module); } @Nonnull public ModuleInfo getModule() { return this.module; } @Override public boolean equals(@Nullable final Object that) { if (that == null) { return false; } if (that == this) { return true; } if (that instanceof GoExclude) { return this.module.equals(((GoExclude) that).module); } return false; } @Override public int hashCode() { return this.module.hashCode(); } @Nonnull @Override public String toString() { return "exclude " + this.module; } @Override public int getPriority() { return 3; } } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/utils/IOUtils.java ================================================ /* * Copyright 2017 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.utils; import com.igormaznitsa.meta.annotation.MayContainNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.Closeable; import java.io.File; import java.io.IOException; import java.util.HashSet; import java.util.Set; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.System.out; /** * Auxiliary class to collect methods for work with IO. * * @since 2.1.7 */ public final class IOUtils { private IOUtils() { } /** * Print text progress bar. * * @param text title of the bar * @param value value to be rendered * @param maxValue max value to be rendered * @param progressBarWidth width of bar * @param lastValue value which was rendered last time, if the same then it will not be rendered * @return rendered value * @since 2.3.0 */ public static int printTextProgressBar(@Nonnull final String text, final long value, final long maxValue, final int progressBarWidth, final int lastValue) { final StringBuilder builder = new StringBuilder(); builder.append("\r\u001B[?25l"); builder.append(text); builder.append("["); final int progress = max(0, min(progressBarWidth, (int) Math.round(progressBarWidth * ((double) value / (double) maxValue)))); for (int i = 0; i < progress; i++) { builder.append('▒'); } for (int i = progress; i < progressBarWidth; i++) { builder.append('-'); } builder.append("]\u001B[?25h"); if (progress != lastValue) { out.print(builder); out.flush(); } return progress; } /** * Make file path appropriate for current OS. * * @param files files which will be added in the path * @return joined file path with OS file separator * @since 2.1.7 */ @Nonnull public static String makeOsFilePathWithoutDuplications( @Nonnull @MayContainNull final File[] files) { final StringBuilder result = new StringBuilder(); final Set alreadyAdded = new HashSet<>(); for (final File f : files) { if (f == null || alreadyAdded.contains(f)) { continue; } alreadyAdded.add(f); if (result.length() > 0) { result.append(File.pathSeparatorChar); } result.append(f.getAbsolutePath()); } return result.toString(); } /** * Make file path from provided strings * * @param paths path elements * @return joined file path with OS file separator * @since 2.1.7 */ @Nonnull public static String makeOsFilePathWithoutDuplications( @Nonnull @MayContainNull final String... paths) { final StringBuilder result = new StringBuilder(); final Set alreadyAdded = new HashSet<>(); for (final String s : paths) { if (s != null && !s.isEmpty() && !alreadyAdded.contains(s)) { alreadyAdded.add(s); if (result.length() > 0) { result.append(File.pathSeparatorChar); } result.append(s); } } return result.toString(); } /** * Close a closeable object quietly, added because such method in APACHE-IO * has been deprecated * * @param closeable object to be closed */ public static void closeSilently(@Nullable final Closeable closeable) { try { if (closeable != null) { closeable.close(); } } catch (final IOException ignoring) { // EXPECTED DO NOTHING } } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/utils/MavenUtils.java ================================================ /* * Copyright 2019 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.utils; import com.igormaznitsa.meta.annotation.MustNotContainNull; import com.igormaznitsa.meta.common.utils.GetUtils; import com.igormaznitsa.mvngolang.AbstractGolangMojo; import com.igormaznitsa.mvngolang.GolangMvnInstallMojo; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.DefaultArtifact; import org.apache.maven.artifact.handler.ArtifactHandler; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecution; import org.apache.maven.project.DefaultProjectBuildingRequest; import org.apache.maven.project.MavenProject; import org.apache.maven.project.ProjectBuildingRequest; import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException; import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult; import org.zeroturnaround.zip.ZipUtil; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.File; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Auxiliary methods to work with maven entities. * * @since 2.3.0 */ public final class MavenUtils { private static final Pattern ARTIFACT_RECORD_PATTERN = Pattern.compile("^([^:]+)::([^:]+)::([^:]*)::([^:]*)::([^:]*)::([^:]*)$"); private MavenUtils() { } /** * Check that execution in a test mode. * * @param execution maven execution object, must not be null * @return true if a test mode is active, false otherwise */ public static boolean isTestPhase(@Nonnull final MojoExecution execution) { final String phase = execution.getLifecyclePhase(); return phase != null && (phase.equals("test") || phase.equals("process-test-resources") || phase.equals("test-compile")); } /** * Make resolve artifact project building request. * * @param session maven session, must not be null * @param remoteRepositories list of remote repositories, must not be null and * can't contain null * @return created request, must not be null */ @Nonnull public static ProjectBuildingRequest makeResolveArtifactProjectBuildingRequest( @Nonnull final MavenSession session, @Nonnull @MustNotContainNull final List remoteRepositories ) { final ProjectBuildingRequest result = new DefaultProjectBuildingRequest(session.getProjectBuildingRequest()); result.setRemoteRepositories(remoteRepositories); result.setLocalRepository(session.getLocalRepository()); return result; } /** * Parse string containing artifact record * * @param record string containing record, must not be null * @param handler artifact handler for created artifact, must not be null * @return new created artifact from the record, must not be null * @throws InvalidVersionSpecificationException it will be thrown if version * format is wrong * @throws IllegalArgumentException it will be thrown if record can't be * recognized as artifact record */ @Nonnull public static Artifact parseArtifactRecord( @Nonnull final String record, @Nonnull final ArtifactHandler handler ) throws InvalidVersionSpecificationException { final Matcher matcher = ARTIFACT_RECORD_PATTERN.matcher(record.trim()); if (matcher.find()) { return new DefaultArtifact( matcher.group(1), matcher.group(2), VersionRange.createFromVersion(matcher.group(3)), matcher.group(4).isEmpty() ? null : matcher.group(4), matcher.group(5).isEmpty() ? null : matcher.group(5), matcher.group(6).isEmpty() ? null : matcher.group(6), handler); } throw new IllegalArgumentException("Can't recognize record as artifact: " + record); } /** * Make artifact record from a maven artifact * * @param artifact artifact to be converted into string, must not be null * @return string representation of artifact, must not be null * @see #parseArtifactRecord(java.lang.String, * org.apache.maven.artifact.handler.ArtifactHandler) */ @Nonnull public static String makeArtifactRecord(@Nonnull final Artifact artifact) { return artifact.getGroupId() + "::" + artifact.getArtifactId() + "::" + artifact.getVersionRange().toString() + "::" + GetUtils.ensureNonNull(artifact.getScope(), "compile") + "::" + GetUtils.ensureNonNull(artifact.getType(), "zip") + "::" + GetUtils.ensureNonNull(artifact.getClassifier(), ""); } /** * Scan project dependencies to find artifacts generated by mvn golang * project. * * @param mavenProject maven project, must not be null * @param ignoreNonResolvedArtifact if true then missing artifact will be ignored, otherwise exception will be thrown * @param includeTestDependencies flag to process dependencies marked for test * phases * @param mojo calling mojo, must not be null * @param session maven session, must not be null * @param execution maven execution, must not be null * @param resolver artifact resolver, must not be null * @param remoteRepositories list of remote repositories, must not be null * @return list of files found in artifacts generated by mvn golang plugin * @throws ArtifactResolverException exception thrown if some artifact can't * be resolved */ @Nonnull @MustNotContainNull public static List> scanForMvnGoArtifacts( @Nonnull final MavenProject mavenProject, final boolean ignoreNonResolvedArtifact, final boolean includeTestDependencies, @Nonnull final AbstractMojo mojo, @Nonnull final MavenSession session, @Nonnull final MojoExecution execution, @Nonnull final ArtifactResolver resolver, @Nonnull @MustNotContainNull final List remoteRepositories ) throws ArtifactResolverException { final List> result = new ArrayList<>(); // final String phase = execution.getLifecyclePhase(); final Set alreadyFoundArtifactRecords = new HashSet<>(); MavenProject currentProject = mavenProject; while (currentProject != null && !Thread.currentThread().isInterrupted()) { final Set projectDependencies = currentProject.getDependencyArtifacts(); final List artifacts = new ArrayList<>( projectDependencies == null ? Collections.emptySet() : projectDependencies); mojo.getLog().debug("Detected dependency artifacts: " + artifacts); while (!artifacts.isEmpty() && !Thread.currentThread().isInterrupted()) { final Artifact artifact = artifacts.remove(0); if (Artifact.SCOPE_TEST.equals(artifact.getScope()) && !includeTestDependencies) { continue; } if (artifact.getType().equals(AbstractGolangMojo.GOARTIFACT_PACKAGING)) { final ArtifactResult artifactResult; try { artifactResult = resolver.resolveArtifact( makeResolveArtifactProjectBuildingRequest(session, remoteRepositories), artifact); } catch (ArtifactResolverException ex) { if (ignoreNonResolvedArtifact) { mojo.getLog().debug("Can't resolve artifact: " + artifact, ex); continue; } else { throw ex; } } final File zipFilePath = artifactResult.getArtifact().getFile(); mojo.getLog().debug( "Detected MVN-GOLANG marker inside ZIP dependency: " + artifact.getGroupId() + ':' + artifact.getArtifactId() + ':' + artifact.getVersion() + ':' + artifact.getType()); if (ZipUtil .containsEntry(zipFilePath, GolangMvnInstallMojo.MVNGOLANG_DEPENDENCIES_FILE)) { final byte[] artifactFlagFile = ZipUtil .unpackEntry(zipFilePath, GolangMvnInstallMojo.MVNGOLANG_DEPENDENCIES_FILE, StandardCharsets.UTF_8); for (final String str : new String(artifactFlagFile, StandardCharsets.UTF_8) .split("\\R")) { if (str.trim().isEmpty() || alreadyFoundArtifactRecords.contains(str)) { continue; } mojo.getLog().debug("Adding mvn-golang dependency: " + str); alreadyFoundArtifactRecords.add(str); try { artifacts.add(parseArtifactRecord(str, new MvnGolangArtifactHandler())); } catch (InvalidVersionSpecificationException ex) { throw new ArtifactResolverException("Can't make artifact: " + str, ex); } } } final File artifactFile = artifactResult.getArtifact().getFile(); mojo.getLog().debug("Artifact file: " + artifactFile); if (doesContainFile(result, artifactFile)) { mojo.getLog().debug("Artifact file ignored as duplication: " + artifactFile); } else { result.add(Tuple.of(artifact, artifactFile)); } } } currentProject = currentProject.hasParent() ? currentProject.getParent() : null; } return result; } private static boolean doesContainFile( @Nonnull @MustNotContainNull final List> list, @Nonnull final File file) { boolean result = false; for (final Tuple t : list) { if (t.right().equals(file)) { result = true; break; } } return result; } @Nullable public static String findProperty( @Nonnull final MavenSession session, @Nonnull final MavenProject project, @Nonnull final String key, @Nullable final String defaultValue ) { final Properties properties = new Properties(project.getProperties()); properties.putAll(session.getSystemProperties()); properties.putAll(session.getUserProperties()); return properties.getProperty(key, defaultValue); } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/utils/MvnGolangArtifactHandler.java ================================================ /* * Copyright 2019 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.utils; import com.igormaznitsa.mvngolang.AbstractGolangMojo; import org.apache.maven.artifact.handler.DefaultArtifactHandler; /** * Artifact handler for mvn-golang artifacts. * * @since 2.3.0 */ public final class MvnGolangArtifactHandler extends DefaultArtifactHandler { public MvnGolangArtifactHandler() { super(AbstractGolangMojo.GOARTIFACT_PACKAGING); this.setExtension("zip"); this.setAddedToClasspath(false); } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/utils/PackageList.java ================================================ /* * Copyright 2018 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.utils; import static java.util.Arrays.asList; import com.igormaznitsa.meta.annotation.MustNotContainNull; import com.igormaznitsa.meta.common.utils.Assertions; import java.io.File; import java.io.IOException; import java.text.ParseException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.annotation.Nonnull; import javax.annotation.Nullable; /** * Parser of package information. * * @since 2.1.9 */ public final class PackageList { private static final String DIRECTIVE_INCLUDE = "#include"; private final List packages; public PackageList(@Nonnull @MustNotContainNull final File file, @Nonnull final String text, @Nonnull final ContentProvider contentProvider) throws ParseException, IOException { final List list = new ArrayList<>(); for (final String s : text.split("\\n")) { final String trimmed = s.trim(); if (!trimmed.isEmpty() && !trimmed.startsWith("//")) { if (trimmed.startsWith(DIRECTIVE_INCLUDE)) { final String filePath = removeQuotes( removeComment(trimmed.substring(DIRECTIVE_INCLUDE.length()).trim(), true)); final File includeFile = new File(file, filePath); final String includedText = contentProvider.readContent(includeFile); list.addAll(new PackageList(includeFile, includedText, contentProvider).getPackages()); } else { list.add(new Package(trimmed)); } } } this.packages = Collections.unmodifiableList(list); } @Nonnull static String removeComment(@Nonnull final String text, final boolean checkQuotes) { int pos = -1; boolean quot = false; boolean found = false; for (int i = 0; i < text.length() && !found; i++) { switch (text.charAt(i)) { case '\"': { quot = !quot; pos = -1; } break; case '/': { if (!checkQuotes || !quot) { if (pos < 0) { pos = i; } else { found = true; } } } break; default: { pos = -1; } break; } } return found ? text.substring(0, pos) : text; } @Nonnull static String removeQuotes(@Nonnull final String text) { String result = text; if (text.length() > 1 && text.startsWith("\"") && text.endsWith("\"")) { result = text.substring(1, text.length() - 1); } return result; } @Nonnull @MustNotContainNull public List getPackages() { return this.packages; } public interface ContentProvider { @Nonnull String readContent(@Nonnull File contentFile) throws IOException; } /** * Container of package information. */ public static final class Package { private static final String TAG_PACKAGE = "package"; private static final String TAG_BRANCH = "branch"; private static final String TAG_TAG = "tag"; private static final String TAG_REVISION = "revision"; private static final Set ALLOWED_KEYS = new HashSet<>(asList(TAG_BRANCH, TAG_PACKAGE, TAG_REVISION, TAG_TAG)); private final String pkg; private final String branch; private final String tag; private final String revision; private final Pattern PATTERN = Pattern .compile("(?:\\s*([^:\\s]+)\\s*:\\s*([^,\\s]+)\\s*(?:,|$)?)|(.+?)", Pattern.CASE_INSENSITIVE); public Package(@Nonnull final String pkg, @Nullable final String branch, @Nullable final String tag, @Nullable final String revision) { this.pkg = Assertions.assertNotNull(pkg); this.branch = branch; this.revision = revision; this.tag = tag; } private Package(@Nonnull String textLine) throws ParseException { textLine = removeComment(textLine, false); final Matcher matcher = PATTERN.matcher(textLine); final Map map = new HashMap<>(); while (matcher.find()) { final String unknown = matcher.group(3); if (unknown != null) { throw new ParseException(textLine, matcher.start(3)); } final String name = matcher.group(1).trim().toLowerCase(Locale.ENGLISH); final String value = matcher.group(2).trim(); if (!ALLOWED_KEYS.contains(name)) { throw new IllegalArgumentException("Unsupported key: " + name); } if (map.containsKey(name)) { throw new ParseException(textLine, matcher.start(1)); } map.put(name, value); } if (!matcher.hitEnd()) { throw new ParseException(textLine, 0); } if (!map.containsKey(TAG_PACKAGE)) { throw new IllegalArgumentException("Can't find package name : " + textLine); } this.pkg = map.get(TAG_PACKAGE); if (this.pkg.isEmpty()) { throw new IllegalArgumentException("Empty package name : " + textLine); } this.branch = map.get(TAG_BRANCH); this.tag = map.get(TAG_TAG); this.revision = map.get(TAG_REVISION); } @Nonnull public String makeString() { return "package: " + this.pkg + ",branch: " + this.branch + ",tag: " + this.tag + ",revision: " + this.revision; } public boolean doesNeedCvsProcessing() { return this.branch != null || this.tag != null || this.revision != null; } @Nonnull public String getPackage() { return this.pkg; } @Nullable public String getBranch() { return this.branch; } @Nullable public String getTag() { return this.tag; } @Nullable public String getRevision() { return this.revision; } @Override @Nonnull public String toString() { return this.pkg; } } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/utils/ProxySettings.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.utils; import javax.annotation.Nonnull; import org.apache.maven.settings.Proxy; /** * Class container for proxy server parameter. * * @since 2.1.1 */ public class ProxySettings { /** * The proxy host. */ public String host = "127.0.0.1"; /** * The proxy protocol. */ public String protocol = "http"; /** * The proxy port. */ public int port = 80; /** * The proxy user. */ public String username; /** * The proxy password. */ public String password = ""; /** * The list of non-proxy hosts (delimited by |). */ public String nonProxyHosts; public ProxySettings() { } public ProxySettings(@Nonnull final Proxy mavenProxy) { this.protocol = mavenProxy.getProtocol(); this.host = mavenProxy.getHost(); this.port = mavenProxy.getPort(); this.username = mavenProxy.getUsername(); this.password = mavenProxy.getPassword(); this.nonProxyHosts = mavenProxy.getNonProxyHosts(); } public boolean hasCredentials() { return this.username != null && this.password != null; } @Override @Nonnull public String toString() { return this.protocol + "://" + this.host + ":" + this.port; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/utils/StringComparatorABC.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.utils; import java.io.Serializable; import java.util.Comparator; import javax.annotation.Nonnull; import javax.annotation.concurrent.ThreadSafe; @ThreadSafe public final class StringComparatorABC implements Comparator, Serializable { private static final long serialVersionUID = -8700761616096593374L; private static final StringComparatorABC INSTANCE = new StringComparatorABC(); private StringComparatorABC() { } @Nonnull public static StringComparatorABC getInstance() { return INSTANCE; } @Override public int compare(@Nonnull final String a, @Nonnull final String b) { return a.compareTo(b); } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/utils/SysUtils.java ================================================ /* * Copyright 2019 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.utils; import org.apache.commons.lang3.SystemUtils; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.Locale; /** * Class contains some auxiliary system related methods. * * @since 2.3.4 */ public final class SysUtils { private SysUtils() { } @Nullable public static String findGoSdkOsType() { final String result; if (SystemUtils.IS_OS_WINDOWS) { result = "windows"; } else if (SystemUtils.IS_OS_FREE_BSD) { result = "freebsd"; } else if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) { result = "darwin"; } else if (SystemUtils.IS_OS_LINUX) { result = "linux"; } else { result = null; } return result; } @Nullable public static String decodeGoSdkArchType(@Nonnull final String osArchProperty) { final String arch = osArchProperty.toLowerCase(Locale.ENGLISH); if (arch.contains("ppc64le")) { return "ppc64le"; } else if (arch.contains("armv6l")) { return "armv6l"; } else if (arch.contains("arm64") || arch.contains("aarch64")) { return "arm64"; } else if (arch.contains("s390")) { return "s390x"; } if (arch.matches("^(x8632|x86|i[3-6]86|ia32|x32)$")) { return "386"; } else if (arch.contains("em64t") || arch.contains("x8664") || arch.contains("ia32e") || arch.contains("x64") || arch.contains("amd64") || arch.contains("x86_64")) { return "amd64"; } return null; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/utils/Tuple.java ================================================ /* * Copyright 2019 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.utils; import com.igormaznitsa.meta.common.utils.Assertions; import javax.annotation.Nonnull; import javax.annotation.Nullable; public class Tuple { private final A left; private final B right; private Tuple(@Nonnull final A left, @Nonnull final B right) { this.left = Assertions.assertNotNull(left); this.right = Assertions.assertNotNull(right); } @Nonnull public static Tuple of(@Nonnull A left, @Nonnull B right) { return new Tuple<>(left, right); } @Override public boolean equals(@Nullable final Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } if (obj instanceof Tuple) { final Tuple that = (Tuple) obj; return this.left.equals(that.left) && this.right.equals(that.right); } return false; } @Override @Nonnull public String toString() { return "Tuple(" + this.left + " ; " + this.right + ')'; } @Override public int hashCode() { return this.left.hashCode() ^ this.right.hashCode(); } @Nonnull public A left() { return this.left; } @Nonnull public B right() { return this.right; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/utils/UnpackUtils.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.utils; import static com.igormaznitsa.mvngolang.utils.IOUtils.closeSilently; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Enumeration; import java.util.Locale; import java.util.zip.GZIPInputStream; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.commons.compress.archivers.ArchiveEntry; import org.apache.commons.compress.archivers.ArchiveException; import org.apache.commons.compress.archivers.ArchiveInputStream; import org.apache.commons.compress.archivers.ArchiveStreamFactory; import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipFile; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; import org.apache.maven.plugin.logging.Log; public final class UnpackUtils { private static final ArchiveStreamFactory ARCHIVE_STREAM_FACTORY = new ArchiveStreamFactory(); private UnpackUtils() { } public static int unpackFileToFolder(@Nonnull final Log logger, @Nullable final String folder, @Nonnull final File archiveFile, @Nonnull final File destinationFolder, final boolean tryMakeAllExecutable) throws IOException { final String normalizedName = archiveFile.getName().toLowerCase(Locale.ENGLISH); final ArchEntryGetter entryGetter; boolean modeZipFile = false; final ZipFile theZipFile; final ArchiveInputStream archInputStream; if (normalizedName.endsWith(".zip")) { logger.debug("Detected ZIP archive"); modeZipFile = true; theZipFile = new ZipFile(archiveFile); archInputStream = null; entryGetter = new ArchEntryGetter() { private final Enumeration iterator = theZipFile.getEntries(); @Override @Nullable public ArchiveEntry getNextEntry() throws IOException { ArchiveEntry result = null; if (this.iterator.hasMoreElements()) { result = this.iterator.nextElement(); } return result; } }; } else { theZipFile = null; final InputStream in = new BufferedInputStream(new FileInputStream(archiveFile)); try { if (normalizedName.endsWith(".tar.gz")) { logger.debug("Detected TAR.GZ archive"); archInputStream = new TarArchiveInputStream(new GZIPInputStream(in)); entryGetter = ((TarArchiveInputStream) archInputStream)::getNextTarEntry; } else { logger.debug("Detected OTHER archive"); archInputStream = ARCHIVE_STREAM_FACTORY.createArchiveInputStream(in); logger.debug("Created archive stream : " + archInputStream.getClass().getName()); entryGetter = archInputStream::getNextEntry; } } catch (ArchiveException ex) { closeSilently(in); throw new IOException("Can't recognize or read archive file : " + archiveFile, ex); } catch (CantReadArchiveEntryException ex) { closeSilently(in); throw new IOException("Can't read entry from archive file : " + archiveFile, ex); } } try { final String normalizedFolder = folder == null ? null : FilenameUtils.normalize(folder, true) + '/'; int unpackedFilesCounter = 0; while (true) { final ArchiveEntry entry = entryGetter.getNextEntry(); if (entry == null) { break; } final String normalizedPath = FilenameUtils.normalize(entry.getName(), true); logger.debug("Detected archive entry : " + normalizedPath); if (normalizedFolder == null || normalizedPath.startsWith(normalizedFolder)) { final File targetFile = new File(destinationFolder, normalizedFolder == null ? normalizedPath : normalizedPath.substring(normalizedFolder.length())); if (entry.isDirectory()) { logger.debug("Folder : " + normalizedPath); if (!targetFile.exists() && !targetFile.mkdirs()) { throw new IOException("Can't create folder " + targetFile); } } else { final File parent = targetFile.getParentFile(); if (parent != null && !parent.isDirectory() && !parent.mkdirs()) { throw new IOException("Can't create folder : " + parent); } try (final FileOutputStream fos = new FileOutputStream(targetFile)) { if (modeZipFile) { logger.debug("Unpacking ZIP entry : " + normalizedPath); final InputStream zipEntryInStream = theZipFile.getInputStream((ZipArchiveEntry) entry); try { if (IOUtils.copy(zipEntryInStream, fos) != entry.getSize()) { throw new IOException( "Can't unpack file, illegal unpacked length : " + entry.getName()); } } finally { closeSilently(zipEntryInStream); } } else { logger.debug("Unpacking archive entry : " + normalizedPath); if (!archInputStream.canReadEntryData(entry)) { throw new IOException("Can't read archive entry data : " + normalizedPath); } if (IOUtils.copy(archInputStream, fos) != entry.getSize()) { throw new IOException( "Can't unpack file, illegal unpacked length : " + entry.getName()); } } } if (tryMakeAllExecutable) { try { if (!targetFile.setExecutable(true, true)) { logger.debug("Can't make file executable : " + targetFile); } } catch (SecurityException ex) { throw new IOException( "Can't make file executable for security reasons : " + targetFile, ex); } } unpackedFilesCounter++; } } else { logger.debug("Archive entry " + normalizedPath + " ignored"); } } return unpackedFilesCounter; } finally { closeSilently(theZipFile); closeSilently(archInputStream); } } private interface ArchEntryGetter { @Nullable ArchiveEntry getNextEntry() throws IOException; } public static class CantReadArchiveEntryException extends RuntimeException { private static final long serialVersionUID = 1989670574345144082L; public CantReadArchiveEntryException(@Nullable final Throwable cause) { super("Can't read archive entry for exception", cause); } } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/utils/WildCardMatcher.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.utils; import java.util.Locale; import java.util.regex.Pattern; import javax.annotation.Nonnull; public final class WildCardMatcher { private final Pattern pattern; private final String addressPattern; public WildCardMatcher(@Nonnull final String txt) { this.addressPattern = txt.trim(); final StringBuilder builder = new StringBuilder(); for (final char c : this.addressPattern.toCharArray()) { switch (c) { case '*': builder.append(".*"); break; case '?': builder.append('.'); break; default: { final String code = Integer.toHexString(c).toUpperCase(Locale.ENGLISH); builder.append("\\u").append("0000", 0, 4 - code.length()).append(code); } break; } } this.pattern = Pattern.compile(builder.toString()); } public boolean match(@Nonnull final String txt) { return this.pattern.matcher(txt).matches(); } @Nonnull @Override public String toString() { return this.addressPattern; } } ================================================ FILE: mvn-golang-wrapper/src/main/java/com/igormaznitsa/mvngolang/utils/XGoogHashHeader.java ================================================ /* * Copyright 2018 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.utils; import com.igormaznitsa.meta.annotation.MustNotContainNull; import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Hex; import org.apache.commons.codec.digest.DigestUtils; import org.apache.http.Header; import org.apache.http.HeaderElement; import org.apache.http.ParseException; import org.apache.maven.plugin.logging.Log; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.*; public class XGoogHashHeader { private final boolean valid; private final String crc32c; private final String md5; private final String unknownType; private final String unknownValue; public XGoogHashHeader(@Nonnull @MustNotContainNull final Header[] headers) { String md5value = null; String crc32value = null; String unknownTypeValue = null; String unknownValueValue = null; boolean valid = true; try { for (final Header header : headers) { for (final HeaderElement e : header.getElements()) { final String name = e.getName(); final String value = Hex.encodeHexString(Base64.decodeBase64(e.getValue())); if (name.equalsIgnoreCase("md5")) { md5value = value; } else if (name.equalsIgnoreCase("crc32c")) { crc32value = value; } else { unknownTypeValue = name; unknownValueValue = value; } } } } catch (ParseException ex) { valid = false; } this.md5 = md5value; this.crc32c = crc32value; this.unknownType = unknownTypeValue; this.unknownValue = unknownValueValue; this.valid = valid; } public boolean hasData() { return this.hasMd5() || this.hasCrc32c(); } public boolean hasMd5() { return this.md5 != null; } @Nullable public String getMd5() { return this.md5; } public boolean hasCrc32c() { return this.crc32c != null; } @Nullable public String getCrc32c() { return this.crc32c; } public boolean isFileOk(@Nonnull final Log log, @Nonnull final File file) throws IOException { if (this.isValid()) { if (this.hasMd5()) { try (final InputStream in = new FileInputStream(file)) { final String calculated = DigestUtils.md5Hex(in); log.debug("Check MD5 hash (reference " + this.md5 + "): " + calculated); return this.md5.equalsIgnoreCase(calculated); } } else if (this.hasCrc32c()) { try (final InputStream in = new BufferedInputStream(new FileInputStream(file), 16384)) { final Crc32c crc = new Crc32c(); crc.update(in); log.debug("Check CRC32C hash (reference " + this.crc32c + "): " + crc); return this.crc32c.equalsIgnoreCase(crc.toString()); } } } throw new IOException("Not valid or doesn't have data"); } @Nonnull @Override public String toString() { final StringBuilder result = new StringBuilder(); result.append("XGoogHashHeader(valid=").append(this.valid) .append(",md5=").append(this.md5) .append(",crc32c=").append(this.crc32c); if (this.unknownType != null) { result.append(',').append(this.unknownType).append('=').append(this.unknownValue); } result.append(')'); return result.toString(); } public boolean isValid() { return this.valid; } private static class Crc32c { private static final long[] CRC_TABLE = { 0x00000000, 0xf26b8303, 0xe13b70f7, 0x1350f3f4, 0xc79a971f, 0x35f1141c, 0x26a1e7e8, 0xd4ca64eb, 0x8ad958cf, 0x78b2dbcc, 0x6be22838, 0x9989ab3b, 0x4d43cfd0, 0xbf284cd3, 0xac78bf27, 0x5e133c24, 0x105ec76f, 0xe235446c, 0xf165b798, 0x030e349b, 0xd7c45070, 0x25afd373, 0x36ff2087, 0xc494a384, 0x9a879fa0, 0x68ec1ca3, 0x7bbcef57, 0x89d76c54, 0x5d1d08bf, 0xaf768bbc, 0xbc267848, 0x4e4dfb4b, 0x20bd8ede, 0xd2d60ddd, 0xc186fe29, 0x33ed7d2a, 0xe72719c1, 0x154c9ac2, 0x061c6936, 0xf477ea35, 0xaa64d611, 0x580f5512, 0x4b5fa6e6, 0xb93425e5, 0x6dfe410e, 0x9f95c20d, 0x8cc531f9, 0x7eaeb2fa, 0x30e349b1, 0xc288cab2, 0xd1d83946, 0x23b3ba45, 0xf779deae, 0x05125dad, 0x1642ae59, 0xe4292d5a, 0xba3a117e, 0x4851927d, 0x5b016189, 0xa96ae28a, 0x7da08661, 0x8fcb0562, 0x9c9bf696, 0x6ef07595, 0x417b1dbc, 0xb3109ebf, 0xa0406d4b, 0x522bee48, 0x86e18aa3, 0x748a09a0, 0x67dafa54, 0x95b17957, 0xcba24573, 0x39c9c670, 0x2a993584, 0xd8f2b687, 0x0c38d26c, 0xfe53516f, 0xed03a29b, 0x1f682198, 0x5125dad3, 0xa34e59d0, 0xb01eaa24, 0x42752927, 0x96bf4dcc, 0x64d4cecf, 0x77843d3b, 0x85efbe38, 0xdbfc821c, 0x2997011f, 0x3ac7f2eb, 0xc8ac71e8, 0x1c661503, 0xee0d9600, 0xfd5d65f4, 0x0f36e6f7, 0x61c69362, 0x93ad1061, 0x80fde395, 0x72966096, 0xa65c047d, 0x5437877e, 0x4767748a, 0xb50cf789, 0xeb1fcbad, 0x197448ae, 0x0a24bb5a, 0xf84f3859, 0x2c855cb2, 0xdeeedfb1, 0xcdbe2c45, 0x3fd5af46, 0x7198540d, 0x83f3d70e, 0x90a324fa, 0x62c8a7f9, 0xb602c312, 0x44694011, 0x5739b3e5, 0xa55230e6, 0xfb410cc2, 0x092a8fc1, 0x1a7a7c35, 0xe811ff36, 0x3cdb9bdd, 0xceb018de, 0xdde0eb2a, 0x2f8b6829, 0x82f63b78, 0x709db87b, 0x63cd4b8f, 0x91a6c88c, 0x456cac67, 0xb7072f64, 0xa457dc90, 0x563c5f93, 0x082f63b7, 0xfa44e0b4, 0xe9141340, 0x1b7f9043, 0xcfb5f4a8, 0x3dde77ab, 0x2e8e845f, 0xdce5075c, 0x92a8fc17, 0x60c37f14, 0x73938ce0, 0x81f80fe3, 0x55326b08, 0xa759e80b, 0xb4091bff, 0x466298fc, 0x1871a4d8, 0xea1a27db, 0xf94ad42f, 0x0b21572c, 0xdfeb33c7, 0x2d80b0c4, 0x3ed04330, 0xccbbc033, 0xa24bb5a6, 0x502036a5, 0x4370c551, 0xb11b4652, 0x65d122b9, 0x97baa1ba, 0x84ea524e, 0x7681d14d, 0x2892ed69, 0xdaf96e6a, 0xc9a99d9e, 0x3bc21e9d, 0xef087a76, 0x1d63f975, 0x0e330a81, 0xfc588982, 0xb21572c9, 0x407ef1ca, 0x532e023e, 0xa145813d, 0x758fe5d6, 0x87e466d5, 0x94b49521, 0x66df1622, 0x38cc2a06, 0xcaa7a905, 0xd9f75af1, 0x2b9cd9f2, 0xff56bd19, 0x0d3d3e1a, 0x1e6dcdee, 0xec064eed, 0xc38d26c4, 0x31e6a5c7, 0x22b65633, 0xd0ddd530, 0x0417b1db, 0xf67c32d8, 0xe52cc12c, 0x1747422f, 0x49547e0b, 0xbb3ffd08, 0xa86f0efc, 0x5a048dff, 0x8ecee914, 0x7ca56a17, 0x6ff599e3, 0x9d9e1ae0, 0xd3d3e1ab, 0x21b862a8, 0x32e8915c, 0xc083125f, 0x144976b4, 0xe622f5b7, 0xf5720643, 0x07198540, 0x590ab964, 0xab613a67, 0xb831c993, 0x4a5a4a90, 0x9e902e7b, 0x6cfbad78, 0x7fab5e8c, 0x8dc0dd8f, 0xe330a81a, 0x115b2b19, 0x020bd8ed, 0xf0605bee, 0x24aa3f05, 0xd6c1bc06, 0xc5914ff2, 0x37faccf1, 0x69e9f0d5, 0x9b8273d6, 0x88d28022, 0x7ab90321, 0xae7367ca, 0x5c18e4c9, 0x4f48173d, 0xbd23943e, 0xf36e6f75, 0x0105ec76, 0x12551f82, 0xe03e9c81, 0x34f4f86a, 0xc69f7b69, 0xd5cf889d, 0x27a40b9e, 0x79b737ba, 0x8bdcb4b9, 0x988c474d, 0x6ae7c44e, 0xbe2da0a5, 0x4c4623a6, 0x5f16d052, 0xad7d5351 }; private static final long LONG_MASK = 0xffffffffL; private static final long BYTE_MASK = 0xff; private long crc; public Crc32c() { this.crc = 0; } public void reset() { this.crc = 0; } public long getCrc() { return this.crc; } public long update(@Nonnull final InputStream in) throws IOException { while (!Thread.currentThread().isInterrupted()) { final int next = in.read(); if (next < 0) { break; } update(next); } return this.crc; } public long update(int b) { long newCrc = this.crc ^ LONG_MASK; newCrc = updateByte((byte) b, newCrc); this.crc = newCrc ^ LONG_MASK; return this.crc; } private long updateByte(byte newByte, long crc) { byte b = (byte) (newByte & BYTE_MASK); int index = (int) ((crc ^ b) & BYTE_MASK); return (CRC_TABLE[index] ^ (crc >> 8)) & LONG_MASK; } @Nonnull @Override public String toString() { final byte[] data = new byte[4]; data[0] = (byte) (this.crc >>> 24); data[1] = (byte) (this.crc >>> 16); data[2] = (byte) (this.crc >>> 8); data[3] = (byte) this.crc; return Hex.encodeHexString(data); } } } ================================================ FILE: mvn-golang-wrapper/src/test/java/com/igormaznitsa/mvngolang/GolangBuildMojoTest.java ================================================ /* * Copyright 2019 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import static java.util.Arrays.asList; import static java.util.Arrays.copyOfRange; import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.CoreMatchers.hasItem; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.junit.Test; public class GolangBuildMojoTest { private GolangBuildMojo makeBuildMojo() { final GolangBuildMojo buildMojo = new GolangBuildMojo(); buildMojo.setPackages(new String[] {"some.pack1", "some.pack2"}); buildMojo.setResultFolder("some/folder"); buildMojo.setResultName("targetName"); return buildMojo; } @Test public void testPackageTest_Multiple() throws Exception { final GolangBuildMojo buildMojo = makeBuildMojo(); assertTrue(buildMojo.getPackages().length > 1); assertThat(asList(buildMojo.getCommandFlags()), not(hasItem("-o"))); assertThat(asList(buildMojo.getCommandFlags()), not(hasItem(endsWith("targetName")))); } @Test public void testPackageTest_Single() throws Exception { final GolangBuildMojo buildMojo = makeBuildMojo(); buildMojo.setPackages(copyOfRange(buildMojo.getPackages(), 0, 1)); assertEquals(1, buildMojo.getPackages().length); assertThat(asList(buildMojo.getCommandFlags()), hasItem("-o")); assertThat(asList(buildMojo.getCommandFlags()), hasItem(endsWith("targetName"))); } } ================================================ FILE: mvn-golang-wrapper/src/test/java/com/igormaznitsa/mvngolang/GolangModMojoCfgTest.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang; import com.igormaznitsa.mvngolang.utils.IOUtils; import com.igormaznitsa.mvngolang.utils.ProxySettings; import org.apache.maven.execution.DefaultMavenExecutionRequest; import org.apache.maven.execution.MavenExecutionRequest; import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.apache.maven.project.MavenProject; import org.apache.maven.project.ProjectBuilder; import org.apache.maven.project.ProjectBuildingRequest; import org.junit.Test; import java.io.File; import static org.junit.Assert.assertArrayEquals; public class GolangModMojoCfgTest extends AbstractMojoTestCase { private static void assertEqualsPath(final String etalon, final String toCheck) { assertFalse("Must contain single path : " + etalon, etalon.contains(File.pathSeparator)); assertFalse("Must contain single path : " + toCheck, etalon.contains(File.pathSeparator)); String normalizedEtalon = etalon.replace('\\', '/'); String normalizedToCheck = toCheck.replace('\\', '/'); normalizedEtalon = new File(normalizedEtalon).getAbsolutePath(); normalizedToCheck = new File(normalizedToCheck).getAbsolutePath(); assertEquals("Wrong path : " + toCheck + " instead of " + etalon, normalizedEtalon, normalizedToCheck); } private T findMojo(final Class klazz, final String pomName, final String goal) throws Exception { final File pomFile = new File(GolangModMojoCfgTest.class.getResource(pomName).toURI()); final MavenExecutionRequest executionRequest = new DefaultMavenExecutionRequest(); final ProjectBuildingRequest buildingRequest = executionRequest.getProjectBuildingRequest(); buildingRequest.setSystemProperties(System.getProperties()); final ProjectBuilder projectBuilder = this.lookup(ProjectBuilder.class); final MavenProject project = projectBuilder.build(pomFile, buildingRequest).getProject(); return klazz.cast(this.lookupConfiguredMojo(project, goal)); } @Override protected void setUp() throws Exception { super.setUp(); } @Override protected void tearDown() throws Exception { super.tearDown(); } @Test public void testGolangCustomMojoConfiguration() throws Exception { final GolangCustomMojo customMojo = findMojo(GolangCustomMojo.class, "mojoCustom.xml", "custom"); assertFalse(customMojo.isModuleMode()); assertTrue(customMojo.getGoCache().contains("${file.separator}")); assertTrue(customMojo.getDependencyTempFolder().endsWith(".__deps__")); assertTrue(customMojo.isScanDependencies()); assertTrue(customMojo.isIncludeTestDependencies()); assertTrue(customMojo.isFilterEnvPath()); assertEquals(60000, customMojo.getConnectionTimeout()); assertFalse(customMojo.isCheckSdkHash()); assertFalse(customMojo.isDisableSslCheck()); assertFalse(customMojo.isUseMavenProxy()); assertFalse(customMojo.getSupposeSdkArchiveFileName()); assertFalse(customMojo.isSkip()); assertNull(customMojo.getProxy()); assertNull(customMojo.getTargetArch()); assertNull(customMojo.getTargetOS()); assertFalse(customMojo.isEnforceGoPathToEnd()); assertNull(customMojo.getTargetArm()); assertFalse(customMojo.isUseEnvVars()); assertEquals("someCustomCommand", customMojo.getGoCommand()); assertFalse(customMojo.isVerbose()); assertTrue(customMojo.isHideBanner()); assertEqualsPath("some/sources", customMojo.getSources(false).getPath()); assertEqualsPath("some/root", customMojo.getGoRoot()); assertEqualsPath("some/path", IOUtils.makeOsFilePathWithoutDuplications(customMojo.findGoPath(false))); assertArrayEquals(new String[] {"one_pack", "two_pack"}, customMojo.getTailArguments()); assertArrayEquals(new String[] {"flag1", "flag2"}, customMojo.getBuildFlags()); assertNull(customMojo.getErrLogFile()); assertNull(customMojo.getOutLogFile()); assertNotNull(customMojo.getReportsFolder()); assertFalse(customMojo.isIgnoreErrorExitCode()); assertEquals("387", customMojo.getTarget386()); } @Test public void testGolangJfrogCliMojoConfiguration() throws Exception { final GolangJfrogCliMojo jfrogCliMojo = findMojo(GolangJfrogCliMojo.class, "mojoJFrogCli.xml", "jfrog-cli"); assertEquals(60000, jfrogCliMojo.getConnectionTimeout()); assertEquals(jfrogCliMojo.getGoCache(), "some/path/cache"); assertFalse(jfrogCliMojo.isCheckSdkHash()); assertFalse(jfrogCliMojo.isDisableSslCheck()); assertFalse(jfrogCliMojo.isUseMavenProxy()); assertFalse(jfrogCliMojo.getSupposeSdkArchiveFileName()); assertFalse(jfrogCliMojo.isSkip()); assertNull(jfrogCliMojo.getProxy()); assertNull(jfrogCliMojo.getTargetArch()); assertNull(jfrogCliMojo.getTargetOS()); assertFalse(jfrogCliMojo.isEnforceGoPathToEnd()); assertNull(jfrogCliMojo.getTargetArm()); assertFalse(jfrogCliMojo.isUseEnvVars()); assertFalse(jfrogCliMojo.isVerbose()); assertTrue(jfrogCliMojo.isHideBanner()); assertEqualsPath("some/sources", jfrogCliMojo.getSources(false).getPath()); assertEqualsPath("some/root", jfrogCliMojo.getGoRoot()); assertEqualsPath("some/path", IOUtils.makeOsFilePathWithoutDuplications(jfrogCliMojo.findGoPath(false))); assertNull(jfrogCliMojo.getErrLogFile()); assertNull(jfrogCliMojo.getOutLogFile()); assertNotNull(jfrogCliMojo.getReportsFolder()); assertFalse(jfrogCliMojo.isIgnoreErrorExitCode()); assertEquals("387", jfrogCliMojo.getTarget386()); assertEqualsPath("some/jfrog", jfrogCliMojo.getCliPath()); assertEquals("mc", jfrogCliMojo.getTarget()); assertEquals("s", jfrogCliMojo.getCommand()); assertArrayEquals( new String[] {"add", "ARTIFACTORY", "my-arti", "--service-url=http://10.100.1.127", "--service-user=admin", "--service-password=password"}, jfrogCliMojo.getArguments().toArray()); } @Test public void testGolangCleanMojoConfiguration() throws Exception { final GolangCleanMojo cleanMojo = findMojo(GolangCleanMojo.class, "mojoClean.xml", "clean"); assertNull(cleanMojo.getWorkingDir()); assertTrue(cleanMojo.isModuleMode()); assertEquals(60000, cleanMojo.getConnectionTimeout()); assertTrue(cleanMojo.isCheckSdkHash()); assertTrue(cleanMojo.isUseMavenProxy()); assertFalse(cleanMojo.isSkip()); assertNull(cleanMojo.getProxy()); assertNull(cleanMojo.getTargetArch()); assertNull(cleanMojo.getTargetOS()); assertNull(cleanMojo.getTargetArm()); assertFalse(cleanMojo.isUseEnvVars()); assertEquals("clean", cleanMojo.getGoCommand()); assertFalse(cleanMojo.isVerbose()); assertTrue(cleanMojo.isHideBanner()); assertEqualsPath("some/sources", cleanMojo.getSources(false).getPath()); assertEqualsPath("some/root", cleanMojo.getGoRoot()); assertEqualsPath("some/path", IOUtils.makeOsFilePathWithoutDuplications(cleanMojo.findGoPath(false))); assertArrayEquals(new String[] {"one_pack", "two_pack"}, cleanMojo.getTailArguments()); assertArrayEquals(new String[] {"flag1", "flag2"}, cleanMojo.getBuildFlags()); assertNull(cleanMojo.getTarget386()); } @Test public void testGolangMvnInstallMojoConfiguration() throws Exception { final GolangMvnInstallMojo mvnInstallMojo = findMojo(GolangMvnInstallMojo.class, "mojoMvnInstall.xml", "mvninstall"); assertEquals(3, mvnInstallMojo.getCompression()); } @Test public void testGolangFixMojoConfiguration() throws Exception { final GolangFixMojo fixMojo = findMojo(GolangFixMojo.class, "mojoFix.xml", "fix"); assertEquals(60000, fixMojo.getConnectionTimeout()); assertTrue(fixMojo.isDisableSslCheck()); assertTrue(fixMojo.isUseMavenProxy()); assertFalse(fixMojo.isSkip()); assertNull(fixMojo.getProxy()); assertFalse(fixMojo.isUseEnvVars()); assertNull(fixMojo.getTargetArm()); assertEquals("fix", fixMojo.getGoCommand()); assertFalse(fixMojo.isVerbose()); assertTrue(fixMojo.isHideBanner()); assertEqualsPath("some/sources", fixMojo.getSources(false).getPath()); assertEqualsPath("some/root", fixMojo.getGoRoot()); assertEqualsPath("some/path", IOUtils.makeOsFilePathWithoutDuplications(fixMojo.findGoPath(false))); assertArrayEquals(new String[] {"one_pack", "two_pack"}, fixMojo.getTailArguments()); assertArrayEquals(new String[] {"flag1", "flag2"}, fixMojo.getBuildFlags()); } @Test public void testGolangFmtMojoConfiguration() throws Exception { final GolangFmtMojo fmtMojo = findMojo(GolangFmtMojo.class, "mojoFmt.xml", "fmt"); assertEquals(60000, fmtMojo.getConnectionTimeout()); assertTrue(fmtMojo.isUseMavenProxy()); assertFalse(fmtMojo.isSkip()); assertNull(fmtMojo.getProxy()); assertFalse(fmtMojo.isUseEnvVars()); assertNull(fmtMojo.getTargetArm()); assertEquals("fmt", fmtMojo.getGoCommand()); assertFalse(fmtMojo.isVerbose()); assertTrue(fmtMojo.isHideBanner()); assertEqualsPath("some/sources", fmtMojo.getSources(false).getPath()); assertEqualsPath("some/root", fmtMojo.getGoRoot()); assertEqualsPath("some/path", IOUtils.makeOsFilePathWithoutDuplications(fmtMojo.findGoPath(false))); assertArrayEquals(new String[] {"one_pack", "two_pack"}, fmtMojo.getTailArguments()); assertArrayEquals(new String[] {"flag1", "flag2"}, fmtMojo.getBuildFlags()); } @Test public void testGolangGenerateMojoConfiguration() throws Exception { final GolangGenerateMojo genMojo = findMojo(GolangGenerateMojo.class, "mojoGenerate.xml", "generate"); assertEquals(60000, genMojo.getConnectionTimeout()); assertTrue(genMojo.isUseMavenProxy()); assertFalse(genMojo.isSkip()); assertNull(genMojo.getProxy()); assertFalse(genMojo.isUseEnvVars()); assertNull(genMojo.getTargetArm()); assertEquals("generate", genMojo.getGoCommand()); assertFalse(genMojo.isVerbose()); assertTrue(genMojo.isHideBanner()); assertEqualsPath("some/sources", genMojo.getSources(false).getPath()); assertEqualsPath("some/root", genMojo.getGoRoot()); assertEqualsPath("some/path", IOUtils.makeOsFilePathWithoutDuplications(genMojo.findGoPath(false))); assertArrayEquals(new String[] {"one_pack", "two_pack"}, genMojo.getTailArguments()); assertArrayEquals(new String[] {"flag1", "flag2"}, genMojo.getBuildFlags()); } @Test public void testGolangInstallMojoConfiguration() throws Exception { final GolangInstallMojo instMojo = findMojo(GolangInstallMojo.class, "mojoInstall.xml", "install"); assertEquals(60000, instMojo.getConnectionTimeout()); assertTrue(instMojo.isUseMavenProxy()); assertFalse(instMojo.isSkip()); assertNull(instMojo.getProxy()); assertFalse(instMojo.isUseEnvVars()); assertNull(instMojo.getTargetArm()); assertEquals("install", instMojo.getGoCommand()); assertFalse(instMojo.isVerbose()); assertTrue(instMojo.isHideBanner()); assertEqualsPath("some/sources", instMojo.getSources(false).getPath()); assertEqualsPath("some/root", instMojo.getGoRoot()); assertEqualsPath("some/path", IOUtils.makeOsFilePathWithoutDuplications(instMojo.findGoPath(false))); assertArrayEquals(new String[] {"one_pack", "two_pack"}, instMojo.getTailArguments()); assertArrayEquals(new String[] {"flag1", "flag2"}, instMojo.getBuildFlags()); } @Test public void testGolangVetMojoConfiguration() throws Exception { final GolangVetMojo vetMojo = findMojo(GolangVetMojo.class, "mojoVet.xml", "vet"); assertEquals(60000, vetMojo.getConnectionTimeout()); assertTrue(vetMojo.isUseMavenProxy()); assertFalse(vetMojo.isSkip()); assertNull(vetMojo.getProxy()); assertFalse(vetMojo.isUseEnvVars()); assertNull(vetMojo.getTargetArm()); assertEquals("vet", vetMojo.getGoCommand()); assertFalse(vetMojo.isVerbose()); assertTrue(vetMojo.isHideBanner()); assertEqualsPath("some/sources", vetMojo.getSources(false).getPath()); assertEqualsPath("some/root", vetMojo.getGoRoot()); assertEqualsPath("some/path", IOUtils.makeOsFilePathWithoutDuplications(vetMojo.findGoPath(false))); assertArrayEquals(new String[] {"one_pack", "two_pack"}, vetMojo.getTailArguments()); assertArrayEquals(new String[] {"flag1", "flag2"}, vetMojo.getBuildFlags()); } @Test public void testGolangTestMojoConfiguration() throws Exception { final GolangTestMojo testMojo = findMojo(GolangTestMojo.class, "mojoTest.xml", "test"); assertEquals("some/someTempFolder", testMojo.getDependencyTempFolder()); assertFalse(testMojo.isScanDependencies()); assertFalse(testMojo.isIncludeTestDependencies()); assertEquals(60000, testMojo.getConnectionTimeout()); assertTrue(testMojo.isUseMavenProxy()); assertNull(testMojo.getProxy()); assertFalse(testMojo.isSkip()); assertFalse(testMojo.isUseEnvVars()); assertNull(testMojo.getTargetArm()); assertEquals("test", testMojo.getGoCommand()); assertFalse(testMojo.isVerbose()); assertTrue(testMojo.isHideBanner()); assertEqualsPath("some/sources", testMojo.getSources(false).getPath()); assertEqualsPath("some/root", testMojo.getGoRoot()); assertEqualsPath("some/path", IOUtils.makeOsFilePathWithoutDuplications(testMojo.findGoPath(false))); assertArrayEquals(new String[] {"one_pack", "two_pack"}, testMojo.getTailArguments()); assertArrayEquals(new String[] {"flag1", "flag2"}, testMojo.getBuildFlags()); assertArrayEquals(new String[] {"binFlag1", "binFlag2"}, testMojo.getTestFlags()); assertTrue(testMojo.isIgnoreErrorExitCode()); } @Test public void testGolangToolMojoConfiguration() throws Exception { final GolangToolMojo toolMojo = findMojo(GolangToolMojo.class, "mojoTool.xml", "tool"); assertEquals(60000, toolMojo.getConnectionTimeout()); assertTrue(toolMojo.isUseMavenProxy()); assertNull(toolMojo.getProxy()); assertFalse(toolMojo.isSkip()); assertFalse(toolMojo.isUseEnvVars()); assertNull(toolMojo.getTargetArm()); assertEquals("tool", toolMojo.getGoCommand()); assertFalse(toolMojo.isVerbose()); assertTrue(toolMojo.isHideBanner()); assertEqualsPath("some/sources", toolMojo.getSources(false).getPath()); assertEquals("theCommand", toolMojo.getCommand()); assertEqualsPath("some/root", toolMojo.getGoRoot()); assertEqualsPath("some/path", IOUtils.makeOsFilePathWithoutDuplications(toolMojo.findGoPath(false))); assertArrayEquals(new String[] {"theCommand", "arg1", "arg2"}, toolMojo.getTailArguments()); assertArrayEquals(new String[] {"flag1", "flag2"}, toolMojo.getBuildFlags()); assertArrayEquals(new String[] {"arg1", "arg2"}, toolMojo.getArgs()); } @Test public void testGolangModMojoConfiguration() throws Exception { final GolangModMojo modMojo = findMojo(GolangModMojo.class, "mojoMod.xml", "mod"); assertTrue(modMojo.isModuleMode()); assertArrayEquals(new String[] {"someCommand"}, modMojo.getCommandFlags()); assertArrayEquals(new String[] {"one", "two", "three"}, modMojo.getTailArguments()); } @Test public void testGolangRunMojoConfiguration() throws Exception { final GolangRunMojo runMojo = findMojo(GolangRunMojo.class, "mojoRun.xml", "run"); assertEquals(60000, runMojo.getConnectionTimeout()); assertTrue(runMojo.isUseMavenProxy()); assertNull(runMojo.getProxy()); assertFalse(runMojo.isSkip()); assertFalse(runMojo.isUseEnvVars()); assertNull(runMojo.getTargetArm()); assertEquals("run", runMojo.getGoCommand()); assertFalse(runMojo.isVerbose()); assertTrue(runMojo.isHideBanner()); assertEqualsPath("some/sources", runMojo.getSources(false).getPath()); assertEquals("main.go", runMojo.getPackages()[0]); assertEqualsPath("some/root", runMojo.getGoRoot()); assertEqualsPath("some/path", IOUtils.makeOsFilePathWithoutDuplications(runMojo.findGoPath(false))); assertArrayEquals(new String[] {"arg1", "arg2"}, runMojo.getArgs()); assertArrayEquals(new String[] {"main.go", "arg1", "arg2"}, runMojo.getTailArguments()); } @Test public void testGolangGetMojoConfiguration() throws Exception { final GolangGetMojo getMojo = findMojo(GolangGetMojo.class, "mojoGet.xml", "get"); final ProxySettings proxy = getMojo.getProxy(); final CustomScript script = getMojo.getCustomScript(); assertFalse(getMojo.isFilterEnvPath()); assertEquals(123000, getMojo.getConnectionTimeout()); assertEquals("some/test/script", script.path); assertTrue(script.ignoreFail); assertArrayEquals(new String[] {"some1", "some2", "some3"}, script.options); assertEquals("https", proxy.protocol); assertEquals("127.33.44.55", proxy.host); assertEquals(999, proxy.port); assertEquals("some user", proxy.username); assertEquals("verysecretpassword", proxy.password); assertEquals("127.0.0.1|127.0.0.2|127.0.0.3", proxy.nonProxyHosts); assertTrue(getMojo.getDeleteCommonPkg()); assertTrue(getMojo.isDisableCvsAutoSearch()); assertEquals("some/relative/path", getMojo.getRelativePathToCvsFolder()); assertArrayEquals(new String[] {"one", "two", "three", "four"}, getMojo.getCustomCvsOptions()); assertEquals("some/custom/exe.exe", getMojo.getCvsExe()); assertTrue(getMojo.isEnforceDeletePackageFiles()); assertFalse(getMojo.isUseMavenProxy()); assertFalse(getMojo.isSkip()); assertFalse(getMojo.isUseEnvVars()); assertEquals("get", getMojo.getGoCommand()); assertNull(getMojo.getUseGoTool()); assertNull(getMojo.getTargetArm()); assertTrue(getMojo.isAutoFixGitCache()); assertFalse(getMojo.isVerbose()); assertTrue(getMojo.isHideBanner()); assertEqualsPath("some/sources", getMojo.getSources(false).getPath()); assertEqualsPath("some/root", getMojo.getGoRoot()); assertEqualsPath("some/path", IOUtils.makeOsFilePathWithoutDuplications(getMojo.findGoPath(false))); assertArrayEquals(new String[] {"flag1", "flag2"}, getMojo.getBuildFlags()); // assertEquals("test.txt",getMojo.getExternalPackageFile()); assertEquals("bin", getMojo.getExecSubpath()); assertEquals("go", getMojo.getExec()); } @Test public void testGolangBuildMojoConfiguration() throws Exception { final GolangBuildMojo buildMojo = findMojo(GolangBuildMojo.class, "mojoBuild.xml", "build"); assertEquals("some/working/dir", buildMojo.getWorkingDir()); assertEquals(60000, buildMojo.getConnectionTimeout()); assertTrue(buildMojo.isUseMavenProxy()); assertNull(buildMojo.getProxy()); assertNotNull(buildMojo); assertTrue(buildMojo.isSkip()); assertTrue(buildMojo.isEnforceGoPathToEnd()); assertEquals("somearch", buildMojo.getTargetArch()); assertEquals("someos", buildMojo.getTargetOS()); assertEquals("5566677", buildMojo.getTargetArm()); assertFalse(buildMojo.isUseEnvVars()); assertEquals("build", buildMojo.getGoCommand()); assertEquals("someGo.bat", buildMojo.getUseGoTool()); assertFalse(buildMojo.isVerbose()); assertFalse(buildMojo.isHideBanner()); assertEquals("plugin", buildMojo.getBuildMode()); assertTrue(buildMojo.isStrip()); assertEqualsPath("some/sources", buildMojo.getSources(false).getPath()); assertEqualsPath("some/root", buildMojo.getGoRoot()); assertEqualsPath("some/path", IOUtils.makeOsFilePathWithoutDuplications(buildMojo.findGoPath(false))); assertEqualsPath("target/place", buildMojo.getResultFolder()); assertEquals("targetName", buildMojo.getResultName()); assertArrayEquals(new String[] {"one_pack", "two_pack"}, buildMojo.getTailArguments()); assertArrayEquals(new String[] {"flag1", "flag2"}, buildMojo.getBuildFlags()); assertArrayEquals(new String[] {"-extldflags", "\"-static\""}, buildMojo.getLdflagsAsList().toArray()); assertEquals(1, buildMojo.getEnv().size()); assertEquals("somevalue", buildMojo.getEnv().get("somekey")); assertEquals("bin/misc", buildMojo.getExecSubpath()); assertEquals("gomobile", buildMojo.getExec()); } } ================================================ FILE: mvn-golang-wrapper/src/test/java/com/igormaznitsa/mvngolang/utils/GoModTest.java ================================================ /* * Copyright 2019 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.utils; import static org.junit.Assert.assertEquals; import java.util.List; import org.junit.Test; public class GoModTest { private void assertModules(final GoMod model, final String... texts) { final List modules = model.find(GoMod.GoModule.class); assertEquals(texts.length, modules.size()); for (int i = 0; i < texts.length; i++) { assertEquals(texts[i], modules.get(i).getModuleInfo().getName()); } } @Test public void testComplex1() { final GoMod model = GoMod.from("module github.com/maruel/panicparse\n" + "\n" + "go 1.11\n" + "\n" + "require (\n" + " github.com/mattn/go-colorable v0.1.1\n" + " github.com/mattn/go-isatty v0.0.7\n" + " github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b\n" + ")"); assertEquals(5, model.size()); assertEquals("module github.com/maruel/panicparse\n" + "require github.com/mattn/go-colorable v0.1.1\n" + "require github.com/mattn/go-isatty v0.0.7\n" + "require github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b\n" + "go 1.11", model.toString()); } @Test public void testComplex2() { final GoMod model = GoMod.from("module google.golang.org/api\n" + "\n" + "require (\n" + " cloud.google.com/go v0.38.0 // indirect\n" + " github.com/golang/protobuf v1.3.1 // indirect\n" + " github.com/google/go-cmp v0.3.0\n" + " github.com/hashicorp/golang-lru v0.5.1 // indirect\n" + " go.opencensus.io v0.21.0\n" + " golang.org/x/lint v0.0.0-20190409202823-959b441ac422\n" + " golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c // indirect\n" + " golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45\n" + " golang.org/x/sync v0.0.0-20190423024810-112230192c58\n" + " golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b\n" + " golang.org/x/text v0.3.2 // indirect\n" + " golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c\n" + " google.golang.org/appengine v1.5.0\n" + " google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873\n" + " google.golang.org/grpc v1.20.1\n" + " honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a\n" + ")"); assertEquals(17, model.size()); assertEquals("module google.golang.org/api\n" + "require cloud.google.com/go v0.38.0\n" + "require github.com/golang/protobuf v1.3.1\n" + "require github.com/google/go-cmp v0.3.0\n" + "require github.com/hashicorp/golang-lru v0.5.1\n" + "require go.opencensus.io v0.21.0\n" + "require golang.org/x/lint v0.0.0-20190409202823-959b441ac422\n" + "require golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c\n" + "require golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45\n" + "require golang.org/x/sync v0.0.0-20190423024810-112230192c58\n" + "require golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b\n" + "require golang.org/x/text v0.3.2\n" + "require golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c\n" + "require google.golang.org/appengine v1.5.0\n" + "require google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873\n" + "require google.golang.org/grpc v1.20.1\n" + "require honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a", model.toString()); } @Test public void testComplex3() { GoMod model = GoMod.from("module \"rsc.io/sampler\"\n" + "\n" + "require \"golang.org/x/text\" v0.0.0-20170915032832-14c0d48ead0c"); assertEquals(2, model.size()); model = GoMod.from("module m\n" + "\n" + "go 1.11\n" + "\n" + "require (\n" + " example.com/a v1.0.0\n" + " example.com/d v1.0.0 // indirect\n" + ")\n" + "\n" + "replace example.com/a => example.com/c v1.0.0"); assertEquals(5, model.size()); assertEquals("module m\n" + "require example.com/a v1.0.0\n" + "require example.com/d v1.0.0\n" + "replace example.com/a => example.com/c v1.0.0\n" + "go 1.11", model.toString()); } @Test public void testComplex4() { final GoMod model = GoMod.from("module example.com/me/hello\n" + "\n" + " require (\n" + " example.com/me/goodbye v0.0.0\n" + " rsc.io/quote v1.5.2\n" + " )\n" + "\n" + " replace example.com/me/goodbye => ../goodbye"); assertEquals(4, model.size()); assertEquals("module example.com/me/hello\n" + "require example.com/me/goodbye v0.0.0\n" + "require rsc.io/quote v1.5.2\n" + "replace example.com/me/goodbye => ../goodbye", model.toString()); } @Test public void testComplex4WindowsPath() { final GoMod model = GoMod.from("module example.com/me/hello\n" + "\n" + " require (\n" + " example.com/me/goodbye v0.0.0\n" + " rsc.io/quote v1.5.2\n" + " )\n" + "\n" + " replace example.com/me/goodbye => ..\\..\\goodbye"); assertEquals(4, model.size()); assertEquals("module example.com/me/hello\n" + "require example.com/me/goodbye v0.0.0\n" + "require rsc.io/quote v1.5.2\n" + "replace example.com/me/goodbye => ..\\..\\goodbye", model.toString()); } @Test public void testComplex5() { final GoMod model = GoMod.from("module github.com/example/project\n" + "\n" + "require (\n" + " github.com/SermoDigital/jose v0.0.0-20180104203859-803625baeddc\n" + " github.com/google/uuid v1.1.0\n" + ")\n" + "\n" + "exclude github.com/SermoDigital/jose v0.9.1\n" + "\n" + "replace github.com/google/uuid v1.1.0 => git.coolaj86.com/coolaj86/uuid.go v1.1.1"); assertEquals(5, model.size()); assertEquals("module github.com/example/project\n" + "require github.com/SermoDigital/jose v0.0.0-20180104203859-803625baeddc\n" + "require github.com/google/uuid v1.1.0\n" + "replace github.com/google/uuid v1.1.0 => git.coolaj86.com/coolaj86/uuid.go v1.1.1\n" + "exclude github.com/SermoDigital/jose v0.9.1", model.toString()); } @Test public void testModule() { assertModules(GoMod.from("module (example.com/hello) // huzzaa"), "example.com/hello"); assertModules(GoMod.from("module (\n" + "example.com/hello // some\n" + " \"sss.gid/fsdsd\" \n" + ") // huzzaa"), "example.com/hello", "sss.gid/fsdsd"); assertModules(GoMod.from("module (example.com/hello) // huzzaa"), "example.com/hello"); assertModules(GoMod.from("module example.com/hello"), "example.com/hello"); assertModules(GoMod.from("module example.com/hello\n"), "example.com/hello"); assertModules(GoMod.from("module example.com/hello // huzzaa"), "example.com/hello"); assertModules(GoMod.from("\n \n module \"example.com/hello\" // huzzaa"), "example.com/hello"); assertModules(GoMod.from("module \"example.com/hello\""), "example.com/hello"); assertModules(GoMod.from("module \"example.com/hello\"\n"), "example.com/hello"); assertModules(GoMod.from("module \"example.com/hello\" // huzzaa"), "example.com/hello"); } } ================================================ FILE: mvn-golang-wrapper/src/test/java/com/igormaznitsa/mvngolang/utils/MavenUtilsTest.java ================================================ /* * Copyright 2019 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.utils; import static org.junit.Assert.assertEquals; import org.apache.maven.artifact.DefaultArtifact; import org.junit.Test; public class MavenUtilsTest { @Test public void testArtifactWithVersion() throws Exception { final DefaultArtifact artifact = new DefaultArtifact("com.igormaznitsa", "some-plugin-test", "1.0", "compile", "jar", null, new MvnGolangArtifactHandler()); assertEquals(artifact, MavenUtils.parseArtifactRecord(MavenUtils.makeArtifactRecord(artifact), new MvnGolangArtifactHandler())); } @Test public void testArtifactWithVersionRange_TwoVersions() throws Exception { final DefaultArtifact artifact = new DefaultArtifact("com.igormaznitsa", "some-plugin-test", "1.0,2.3", "compile", "jar", null, new MvnGolangArtifactHandler()); assertEquals(artifact, MavenUtils.parseArtifactRecord(MavenUtils.makeArtifactRecord(artifact), new MvnGolangArtifactHandler())); } @Test public void testArtifactWithVersionRange_RangeDiapasone() throws Exception { final DefaultArtifact artifact = new DefaultArtifact("com.igormaznitsa", "some-plugin-test", "(,1.0]", "compile", "jar", null, new MvnGolangArtifactHandler()); assertEquals(artifact, MavenUtils.parseArtifactRecord(MavenUtils.makeArtifactRecord(artifact), new MvnGolangArtifactHandler())); } @Test public void testArtifactWithVersionRange_AllFieldsSet() throws Exception { final DefaultArtifact artifact = new DefaultArtifact("com.igormaznitsa", "some-plugin-test", "(,1.0]", "compile", "jar", "someclassifier", new MvnGolangArtifactHandler()); assertEquals(artifact, MavenUtils.parseArtifactRecord(MavenUtils.makeArtifactRecord(artifact), new MvnGolangArtifactHandler())); } } ================================================ FILE: mvn-golang-wrapper/src/test/java/com/igormaznitsa/mvngolang/utils/PackageListTest.java ================================================ /* * Copyright 2018 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.utils; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import java.io.File; import java.io.IOException; import java.text.ParseException; import javax.annotation.Nonnull; import org.apache.commons.io.FilenameUtils; import org.junit.Test; public class PackageListTest { private static final File FAKE_FILE = new File("."); private static final PackageList.ContentProvider STUB_CP = new PackageList.ContentProvider() { @Override @Nonnull public String readContent(@Nonnull final File file) throws IOException { throw new Error("Must not be called"); } }; @Test public void testRemoveQuotes() { assertEquals("", PackageList.removeQuotes("")); assertEquals("\"", PackageList.removeQuotes("\"")); assertEquals("", PackageList.removeQuotes("\"\"")); assertEquals("a", PackageList.removeQuotes("\"a\"")); assertEquals("a\"", PackageList.removeQuotes("a\"")); assertEquals("\"", PackageList.removeQuotes("\"\"\"")); } @Test public void testRemoveComment_CheckQuotes_False() { assertEquals("", PackageList.removeComment("//", false)); assertEquals("a", PackageList.removeComment("a//", false)); assertEquals("a", PackageList.removeComment("a//b", false)); assertEquals("a ", PackageList.removeComment("a //b", false)); assertEquals("#include", PackageList.removeComment("#include//dddd", false)); assertEquals("#include a/b/c", PackageList.removeComment("#include a/b/c//dddd", false)); assertEquals("#include \"a/b/c", PackageList.removeComment("#include \"a/b/c//dddd\"", false)); assertEquals("#include \"a/b/c", PackageList.removeComment("#include \"a/b/c//dddd\" // jjj", false)); assertEquals("#include \"a/b/c\"", PackageList.removeComment("#include \"a/b/c\"//dddd\"", false)); } @Test public void testRemoveComment_CheckQuotes_True() { assertEquals("", PackageList.removeComment("//", true)); assertEquals("a", PackageList.removeComment("a//", true)); assertEquals("a", PackageList.removeComment("a//b", true)); assertEquals("a ", PackageList.removeComment("a //b", true)); assertEquals("#include", PackageList.removeComment("#include//dddd", true)); assertEquals("#include a/b/c", PackageList.removeComment("#include a/b/c//dddd", true)); assertEquals("#include \"a/b/c//dddd\"", PackageList.removeComment("#include \"a/b/c//dddd\"", true)); assertEquals("#include \"a/b/c//dddd\" ", PackageList.removeComment("#include \"a/b/c//dddd\" // kkkk", true)); assertEquals("#include \"a/b/c\"", PackageList.removeComment("#include \"a/b/c\"//dddd\"", true)); } @Test public void testEmptyText() throws Exception { assertEquals(0, new PackageList(FAKE_FILE, "", STUB_CP).getPackages().size()); } @Test public void testOnlyCommentLine() throws Exception { assertEquals(0, new PackageList(FAKE_FILE, "// comment", STUB_CP).getPackages().size()); } @Test public void testOnlyPackageName() throws Exception { final PackageList parsed = new PackageList(FAKE_FILE, "// text\npackage: github.com/gizak/termui", STUB_CP); assertEquals(1, parsed.getPackages().size()); assertEquals("github.com/gizak/termui", parsed.getPackages().get(0).getPackage()); assertNull(parsed.getPackages().get(0).getBranch()); assertNull(parsed.getPackages().get(0).getRevision()); assertNull(parsed.getPackages().get(0).getTag()); } @Test public void testTwoPackages() throws Exception { final PackageList parsed = new PackageList(FAKE_FILE, "// text\n" + "package: github.com/gizak/termui // ,tag:mustbeignored\n" + "package: some/pack , branch:445566, tag:sometag, revision: r.33.3434342323", STUB_CP); assertEquals(2, parsed.getPackages().size()); assertEquals("github.com/gizak/termui", parsed.getPackages().get(0).getPackage()); assertNull(parsed.getPackages().get(0).getBranch()); assertNull(parsed.getPackages().get(0).getRevision()); assertNull(parsed.getPackages().get(0).getTag()); assertEquals("some/pack", parsed.getPackages().get(1).getPackage()); assertEquals("445566", parsed.getPackages().get(1).getBranch()); assertEquals("sometag", parsed.getPackages().get(1).getTag()); assertEquals("r.33.3434342323", parsed.getPackages().get(1).getRevision()); } @Test public void testInclude() throws Exception { final PackageList parsed = new PackageList(FAKE_FILE, "#include \"./another\"//testinclude\npackage: one\npackage: two", new PackageList.ContentProvider() { @Override @Nonnull public String readContent(@Nonnull final File pathElements) throws IOException { assertEquals("another", FilenameUtils.normalize(pathElements.getPath())); return "package: external"; } }); assertEquals(3, parsed.getPackages().size()); assertEquals("external", parsed.getPackages().get(0).getPackage()); assertEquals("one", parsed.getPackages().get(1).getPackage()); assertEquals("two", parsed.getPackages().get(2).getPackage()); } @Test(expected = ParseException.class) public void testWrongFormat_NoKey() throws Exception { new PackageList(FAKE_FILE, ":jjj", STUB_CP); } @Test(expected = ParseException.class) public void testWrongFormat_OnlyKey() throws Exception { new PackageList(FAKE_FILE, "package:", STUB_CP); } @Test(expected = IllegalArgumentException.class) public void testWrongFormat_WrongKey() throws Exception { new PackageList(FAKE_FILE, "packge: some", STUB_CP); } @Test(expected = ParseException.class) public void testWrongFormat_DoubleQuotes() throws Exception { new PackageList(FAKE_FILE, "package: some/pack , branch:445566, tag:sometag,, revision: r.33.3434342323", STUB_CP); } } ================================================ FILE: mvn-golang-wrapper/src/test/java/com/igormaznitsa/mvngolang/utils/StringComparatorABCTest.java ================================================ /* * Copyright 2016 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.utils; import static org.junit.Assert.assertArrayEquals; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.junit.Test; public class StringComparatorABCTest { @Test public void testSorting() { final List list = Arrays.asList("b", "c", "1", "hello", "ABC", "A"); Collections.sort(list, StringComparatorABC.getInstance()); assertArrayEquals(new String[] {"1", "A", "ABC", "b", "c", "hello"}, list.toArray()); } } ================================================ FILE: mvn-golang-wrapper/src/test/java/com/igormaznitsa/mvngolang/utils/SysUtilsTest.java ================================================ /* * Copyright 2019 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mvngolang.utils; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import org.junit.Test; public class SysUtilsTest { @Test public void testDecodeGoSdkArchType() { assertNull(SysUtils.decodeGoSdkArchType("some xxx")); assertEquals("armv6l", SysUtils.decodeGoSdkArchType("some armv6l xxx")); assertEquals("ppc64le", SysUtils.decodeGoSdkArchType("ppc ppc64le")); assertEquals("ppc64le", SysUtils.decodeGoSdkArchType("ppc64le")); assertEquals("386", SysUtils.decodeGoSdkArchType("i386")); assertEquals("386", SysUtils.decodeGoSdkArchType("i686")); assertEquals("amd64", SysUtils.decodeGoSdkArchType("amd64")); assertEquals("arm64", SysUtils.decodeGoSdkArchType("aarch64")); assertEquals("s390x", SysUtils.decodeGoSdkArchType("s390")); } } ================================================ FILE: mvn-golang-wrapper/src/test/resources/com/igormaznitsa/mvngolang/mojoBuild.xml ================================================ 4.0.0 com.igormaznitsa mvngolang-tests 1.0.0-SNAPSHOT jar Test GoLangMojo com.igormaznitsa mvn-golang-wrapper build true some/working/dir true someos somearch 5566677 someGo.bat target/place targetName false some/root some/path some/sources gomobile /bin/misc/ plugin true true -extldflags "-static" flag1 flag2 one_pack two_pack somevalue ================================================ FILE: mvn-golang-wrapper/src/test/resources/com/igormaznitsa/mvngolang/mojoClean.xml ================================================ 4.0.0 com.igormaznitsa mvngolang-tests jar Test GoLangMojo 1.0.0-SNAPSHOT true com.igormaznitsa mvn-golang-wrapper clean true some/root some/path some/sources flag1 flag2 one_pack two_pack ================================================ FILE: mvn-golang-wrapper/src/test/resources/com/igormaznitsa/mvngolang/mojoCustom.xml ================================================ 4.0.0 com.igormaznitsa mvngolang-tests 1.0.0-SNAPSHOT jar Test GoLangMojo com.igormaznitsa mvn-golang-wrapper custom false false false someCustomCommand 387 some/root some/path some/sources flag1 flag2 one_pack two_pack ================================================ FILE: mvn-golang-wrapper/src/test/resources/com/igormaznitsa/mvngolang/mojoFix.xml ================================================ 4.0.0 com.igormaznitsa mvngolang-tests 1.0.0-SNAPSHOT jar Test GoLangMojo com.igormaznitsa mvn-golang-wrapper fix some/root some/path true some/sources flag1 flag2 one_pack two_pack ================================================ FILE: mvn-golang-wrapper/src/test/resources/com/igormaznitsa/mvngolang/mojoFmt.xml ================================================ 4.0.0 com.igormaznitsa mvngolang-tests 1.0.0-SNAPSHOT jar Test GoLangMojo com.igormaznitsa mvn-golang-wrapper fmt some/root some/path some/sources flag1 flag2 one_pack two_pack ================================================ FILE: mvn-golang-wrapper/src/test/resources/com/igormaznitsa/mvngolang/mojoGenerate.xml ================================================ 4.0.0 com.igormaznitsa mvngolang-tests 1.0.0-SNAPSHOT jar Test GoLangMojo com.igormaznitsa mvn-golang-wrapper generate some/root some/path some/sources flag1 flag2 one_pack two_pack ================================================ FILE: mvn-golang-wrapper/src/test/resources/com/igormaznitsa/mvngolang/mojoGet.xml ================================================ 4.0.0 com.igormaznitsa mvngolang-tests 1.0.0-SNAPSHOT jar Test GoLangMojo com.igormaznitsa mvn-golang-wrapper get https 127.33.44.55 999 some user verysecretpassword 127.0.0.1|127.0.0.2|127.0.0.3 false 123000 test.txt false true some/custom/exe.exe true some/relative/path true some/root some/path some/sources true one two three four flag1 flag2 one_pack two_pack some/test/script true ================================================ FILE: mvn-golang-wrapper/src/test/resources/com/igormaznitsa/mvngolang/mojoInstall.xml ================================================ 4.0.0 com.igormaznitsa mvngolang-tests 1.0.0-SNAPSHOT jar Test GoLangMojo com.igormaznitsa mvn-golang-wrapper install some/root some/path some/sources flag1 flag2 one_pack two_pack ================================================ FILE: mvn-golang-wrapper/src/test/resources/com/igormaznitsa/mvngolang/mojoJFrogCli.xml ================================================ 4.0.0 com.igormaznitsa mvngolang-tests 1.0.0-SNAPSHOT jar Test GoLangMojo com.igormaznitsa mvn-golang-wrapper jfrog-cli false false false 387 some/root some/path some/sources some/path/cache some/jfrog mc s add ARTIFACTORY my-arti --service-url=http://10.100.1.127 --service-user=admin --service-password=password ================================================ FILE: mvn-golang-wrapper/src/test/resources/com/igormaznitsa/mvngolang/mojoMod.xml ================================================ 4.0.0 com.igormaznitsa mvngolang-tests 1.0.0-SNAPSHOT jar Test GoLangMojo com.igormaznitsa mvn-golang-wrapper mod someCommand one two three ================================================ FILE: mvn-golang-wrapper/src/test/resources/com/igormaznitsa/mvngolang/mojoMvnInstall.xml ================================================ 4.0.0 com.igormaznitsa mvngolang-tests 1.0.0-SNAPSHOT jar Test GoLangMojo com.igormaznitsa mvn-golang-wrapper mvninstall 3 ================================================ FILE: mvn-golang-wrapper/src/test/resources/com/igormaznitsa/mvngolang/mojoRun.xml ================================================ 4.0.0 com.igormaznitsa mvngolang-tests 1.0.0-SNAPSHOT jar Run GoLangMojo com.igormaznitsa mvn-golang-wrapper run some/root some/path some/sources main.go arg1 arg2 ================================================ FILE: mvn-golang-wrapper/src/test/resources/com/igormaznitsa/mvngolang/mojoTest.xml ================================================ 4.0.0 com.igormaznitsa mvngolang-tests 1.0.0-SNAPSHOT jar Test GoLangMojo com.igormaznitsa mvn-golang-wrapper test false false some/someTempFolder true some/root some/path some/sources flag1 flag2 one_pack two_pack binFlag1 binFlag2 ================================================ FILE: mvn-golang-wrapper/src/test/resources/com/igormaznitsa/mvngolang/mojoTool.xml ================================================ 4.0.0 com.igormaznitsa mvngolang-tests 1.0.0-SNAPSHOT jar Test GoLangMojo com.igormaznitsa mvn-golang-wrapper tool some/root some/path some/sources flag1 flag2 theCommand arg1 arg2 ================================================ FILE: mvn-golang-wrapper/src/test/resources/com/igormaznitsa/mvngolang/mojoVet.xml ================================================ 4.0.0 com.igormaznitsa mvngolang-tests 1.0.0-SNAPSHOT jar Test GoLangMojo com.igormaznitsa mvn-golang-wrapper vet some/root some/path some/sources flag1 flag2 one_pack two_pack ================================================ FILE: pom.xml ================================================ 4.0.0 com.igormaznitsa mvn-golang 2.3.11-SNAPSHOT pom mvn-golang Maven plugin to wrap main GoLang commands and provide way to build GoLang applications with Apache Maven build tool. https://github.com/raydac/mvn-golang 2016 2.3.10 UTF-8 yyyyMMddHHmm 1.1.3 1.0.3 3.0 GitHub Issues https://github.com/raydac/mvn-golang/issues raydac Igor Maznitsa rrg4400@gmail.com https://www.igormaznitsa.com +2 developer https://github.com/raydac/mvn-golang scm:git:git://github.com/raydac/mvn-golang.git scm:git:git@github.com:raydac/mvn-golang.git Igor Maznitsa http://www.igormaznitsa.com The Apache Software License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt repo junit junit 4.13.2 test plugin true mvn-golang-wrapper mvn-golang-hello mvn-golang-hello-multi examples mvn-golang-examples org.apache.maven.plugins maven-enforcer-plugin no-duplicate-declared-dependencies enforce org.apache.maven.plugins maven-compiler-plugin org.apache.maven.plugins maven-plugin-plugin default-descriptor process-classes org.apache.maven.plugins maven-enforcer-plugin 3.0.0 org.apache.maven.plugins maven-gpg-plugin 3.2.4 org.apache.maven.plugins maven-assembly-plugin 3.7.1 org.apache.maven.plugins maven-source-plugin 3.3.1 org.apache.maven.plugins maven-javadoc-plugin 3.7.0 org.apache.maven.plugins maven-compiler-plugin 3.13.0 -Xlint:all 1.8 1.8 false true true org.apache.maven.plugins maven-plugin-plugin 3.5.2 org.apache.maven.plugins maven-install-plugin 2.5.2 org.apache.maven.plugins maven-deploy-plugin 2.8.2 org.apache.maven.plugins maven-resources-plugin 3.1.0 org.apache.maven.plugins maven-jar-plugin 3.1.0 org.apache.maven.plugins maven-surefire-plugin 2.22.0 org.apache.maven.plugins maven-failsafe-plugin 2.22.0 org.apache.maven.plugins maven-clean-plugin 3.1.0