### 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
### 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
================================================

> [!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.
[](http://www.apache.org/licenses/LICENSE-2.0)
[](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
[](http://search.maven.org/#artifactdetails|com.igormaznitsa|mvn-golang-wrapper|2.3.10|jar)
[](https://maven.apache.org/)
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AHWJHJFBAWGL2)
[](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.

# 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}bincom.igormaznitsamvn-golang-wrapper2.3.10truerunmain.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.igormaznitsamvn-go-test-lib1.0.0-SNAPSHOTmvn-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-getgithub.com/gizak/termuigithub.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-ugithub.com/gizak/termuiv2
```
if you want to have several dependencies with different tag and branch then take a look at the snipet below
```xml
dependency1getgithub.com/some/framework1.0.1dependency2getgithub.com/some/anotherv2
```
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
truetrue
```
or disable plugin mojo execution
```xml
default-mvninstallnone
```
# 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-ugithub.com/smartystreets/goconveydefault-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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-azul3d-mandelbrot1.0.0-SNAPSHOTmvn-golangAzul3d mandelbrot exampleExample of Azul3d mandelbrot project build.${basedir}${file.separator}src${basedir}${file.separator}binorg.apache.maven.pluginsmaven-resources-plugin3.2.0copy-resourcespackagecopy-resources${project.build.directory}${project.basedir}${file.separator}resourcescom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}truemoddefault-fixnone
================================================
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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-clui1.0.0-SNAPSHOTmvn-golangCLUI exampleExample of usage CLUI library for GUI (https://github.com/VladimirMarkelov/clui).${basedir}${file.separator}src${basedir}${file.separator}bin${basedir}${file.separator}resmaven-resources-plugin3.0.2copy-resourcesvalidatecopy-resources${project.build.directory}${basedir}${file.separator}resfalsecom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}autoget-dependenciesgetgithub.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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-fynemvn-golangTermUI exampleIt builds a sample from https://github.com/fyne-io/fyne${go.sdk.version}${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}truetrue
================================================
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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-genbindata1.0.0-SNAPSHOTmvn-golangExample of GEN + BinDataExample of GoBinData utility call from 'gen' command.${basedir}${file.separator}src${basedir}${file.separator}bin${basedir}${file.separator}datacom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}${basedir}${file.separator}binautodefault-getget-utruegithub.com/jteeuwen/go-bindata/...default-buildrunmain.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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-gocuimvn-golangGOCUI exampleExample of GOCUI https://github.com/jroimartin/gocui${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}autodefault-getgithub.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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-goexample1.0.0-SNAPSHOTmvn-golangGoExampleExample of minimalistic usage of mvn-golang-wrapper to build a 'Hello World' example.${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}trueauto${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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-gotermmvn-golangGoTerm exampleExample of GoTerm usage with GoLang https://github.com/buger/goterm${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}autodefault-get-utruegithub.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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-gui1.0.0-SNAPSHOTmvn-golangGUI exampleExample of minimalistic GUI application.${basedir}${file.separator}dependencies.txt${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-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-devauto
================================================
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.0com.igormaznitsa.go-gwtmvn-golang-example-gui-gwt1.0.0-SNAPSHOTbackend1.0.0-SNAPSHOTmvn-golangBackend part of the GoLang+GWT example, it implements the server side.${project.groupId}frontend${project.version}providedunder-windowswindows.exe${project.artifactId}-${project.version}${final.extension}${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}auto${basedir}${file.separator}bindefault-getget-utruegithub.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.0com.igormaznitsa.go-gwtmvn-golang-example-gui-gwt1.0.0-SNAPSHOTfrontendjarFrontend part of the GoLang+GWT example, it implements web based GUI.org.gwtprojectgwt-userprovidedorg.gwtprojectgwt-devprovidedjunitjunit4.13.2testfrontend.out${project.build.directory}/${project.build.finalName}/WEB-INF/classesorg.apache.maven.pluginsmaven-compiler-plugin3.7.01.81.8org.apache.maven.pluginsmaven-war-plugin3.2.0war-explodedpackageexplodedorg.apache.maven.pluginsmaven-clean-plugindelete-webinf-in-resultpackagecleantrue${project.build.directory}/${project.build.finalName}/WEB-INF${project.build.directory}/${project.build.finalName}/META-INFfalseorg.codehaus.mojogwt-maven-plugin2.8.1compileindex.htmlcom.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
================================================
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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTcom.igormaznitsa.go-gwtmvn-golang-example-gui-gwt1.0.0-SNAPSHOTpomUTF-8${main-project-version}1.81.82.11.0frontendbackendorg.gwtprojectgwt${gwt.version}pomimport
================================================
FILE: mvn-golang-examples/mvn-golang-example-helloworld/pom.xml
================================================
4.0.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-helloworld1.0.0-SNAPSHOTmvn-golangHello World exampleExample of minimalistic usage of mvn-golang-wrapper to build a 'Hello World' example.${basedir}${file.separator}src${basedir}${file.separator}binexec-maven-pluginorg.codehaus.mojo1.6.0initializeexecbash-cecho build.date.stamp=`date +%Y%m%d.%H%M%S`${project.build.directory}/timestamp.propertiesorg.codehaus.mojoproperties-maven-plugin1.0.0initializeread-project-properties${project.build.directory}/timestamp.propertiescom.igormaznitsamvn-golang-wrapper${main-project-version}trueauto${go.sdk.version}default-build-X"main.Buildstamp=${build.date.stamp}"-X"main.svnRevision=22543"default-testnonego-vettest-compilevettruevet.out.logvet.err.logorg.apache.maven.pluginsmaven-enforcer-plugin3.0.0-M3check-vet-out-log-sizetest-compileenforce00${project.build.directory}${file.separator}reports${file.separator}vet.out.logtruecheck-vet-err-log-sizetest-compileenforce100200${project.build.directory}${file.separator}reports${file.separator}vet.err.logtrue
================================================
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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-helloworld-gomod1.0.0-SNAPSHOTmvn-golangHello World with go.mod exampleExample of go.mod use to get needed dependencies.https://www.mycodesmells.com/post/go-modules-example${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}truego-listlist{{.String}}truedo-runrunmain.go-namesomename
================================================
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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-helloworld-multisrc1.0.0-SNAPSHOTmvn-golangHello World multi-src exampleExample of minimalistic usage of mvn-golang-wrapper to build a 'Hello World' example with multiple source folders.${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}auto${basedir}${file.separator}lib1${basedir}${file.separator}lib2runmain.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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-logrusmvn-golangGo Logrus use exampleExample of use Logrus library from https://banzaicloud.com/blog/runtime-logging/${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}autodefault-getgithub.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.0com.igormaznitsamvn-golang-example-maven-module-mix1.0.0-SNAPSHOTmvn-go-test-mix-appmvn-golangcom.igormaznitsamvn-go-test-mix-terminal1.0.0-SNAPSHOTmvn-golangcom.igormaznitsamvn-go-test-mix-proxy1.0.0-SNAPSHOTmvn-golang${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}autoprint-module-graphvalidatemodgraphdo-vetvetdo-runrunmain.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.0com.igormaznitsamvn-golang-example-maven-module-mix1.0.0-SNAPSHOTmvn-go-test-mix-proxymvn-golang${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-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.0com.igormaznitsamvn-golang-example-maven-module-mix1.0.0-SNAPSHOTmvn-go-test-mix-terminalmvn-golang${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-maven-module-mixpomExample of use maven dependency together with golang modulestruemvn-go-test-mix-terminalmvn-go-test-mix-proxymvn-go-test-mix-app
================================================
FILE: mvn-golang-examples/mvn-golang-example-maven-repository/mvn-go-test-app/pom.xml
================================================
4.0.0com.igormaznitsamvn-golang-example-maven-repository1.0.0-SNAPSHOTmvn-go-test-appmvn-golangcom.igormaznitsamvn-go-test-lib1.0.0-SNAPSHOTmvn-golangcom.igormaznitsamvn-go-test-libtwo1.0.0-SNAPSHOTmvn-golang${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}autodo-vetvetdo-runrunoffmain.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.0com.igormaznitsamvn-golang-example-maven-repository1.0.0-SNAPSHOTmvn-go-test-libmvn-golangcom.igormaznitsamvn-go-test-metalib1.0.0-SNAPSHOTmvn-golang${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-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.0com.igormaznitsamvn-golang-example-maven-repository1.0.0-SNAPSHOTmvn-go-test-libtwomvn-golangcom.igormaznitsamvn-go-test-metalib1.0.0-SNAPSHOTmvn-golang${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-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.0com.igormaznitsamvn-golang-example-maven-repository1.0.0-SNAPSHOTmvn-go-test-metalibmvn-golang${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-maven-repositorypomExample of dependency from Maven repositoryExample how to use mvn-golang artifact saved in maven repositorytruefalsemvn-go-test-metalibmvn-go-test-libmvn-go-test-libtwomvn-go-test-app
================================================
FILE: mvn-golang-examples/mvn-golang-example-multimodule/app-1/pom.xml
================================================
4.0.0com.igormaznitsamvn-golang-example-multimodule1.0-SNAPSHOTapp-1mvn-golangApp-1${basedir}${file.separator}src${basedir}${file.separator}bin${basedir}${file.separator}resourcescom.igormaznitsamvn-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.0com.igormaznitsamvn-golang-example-multimodule1.0-SNAPSHOTapp-2mvn-golangApp-2${basedir}${file.separator}src${basedir}${file.separator}bin${basedir}${file.separator}resourcescom.igormaznitsamvn-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-assemblytar.gzfalsefalse${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.0com.igormaznitsamvn-golang-example-multimodule1.0-SNAPSHOTassembly-resultspomAssembly results${project.groupId}app-1${project.version}mvn-golangprovided${project.groupId}app-2${project.version}mvn-golangprovidedall-apps-${project.version}org.apache.maven.pluginsmaven-clean-plugin3.0.0falsetrue${basedir}${file.separator}targetmaven-assembly-plugin3.1.0false${basedir}/target${basedir}/deploy.xmlcreate-archivepackagesingle
================================================
FILE: mvn-golang-examples/mvn-golang-example-multimodule/common/pom.xml
================================================
4.0.0com.igormaznitsamvn-golang-example-multimodule1.0-SNAPSHOTcommonmvn-golangCommontruetruetrue${basedir}${file.separator}src${basedir}${file.separator}bin${basedir}${file.separator}resourcescom.igormaznitsamvn-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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-multimodule1.0-SNAPSHOTpomUTF-8${main-project-version}commonapp-1app-2assembly-results
================================================
FILE: mvn-golang-examples/mvn-golang-example-nes/pom.xml
================================================
4.0.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-nesmvn-golangNES emulator exampleExample of mvn-golang-wrapper usage to build the NES emulator project : https://github.com/fogleman/nes${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}truedefault-get-utruegithub.com/gordonklaus/portaudiogithub.com/fogleman/nesdefault-buildIf error with native parts then install them with : sudo apt-get install portaudio19-dev libgl1-mesa-dev xorg-devgithub.com/fogleman/nes${go.sdk.version}auto
================================================
FILE: mvn-golang-examples/mvn-golang-example-oak-shooter/pom.xml
================================================
4.0.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-oak-shooter1.0.0-SNAPSHOTmvn-golangOak shooter exampleExample of Oak engine based 2D shooter.${basedir}${file.separator}src${basedir}${file.separator}binorg.apache.maven.pluginsmaven-resources-plugin3.2.0copy-resourcespackagecopy-resources${project.build.directory}${project.basedir}${file.separator}resourcescom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}truemoddefault-fixnone
================================================
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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-plugin1.0.0-SNAPSHOTmvn-golangGoLang plugin exampleExample of minimalistic GoLang plugin.sobuild-for-windowswindowsdllgo_plugin.${result.file.extension}${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}autodefault-buildplugin
================================================
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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-preprocessing1.0.0-SNAPSHOTmvn-golangExample of preprocessingExample of Java Comment Preprocessor with GoLang.${project.build.directory}${file.separator}.preprocessed_src${basedir}${file.separator}src${basedir}${file.separator}binorg.codehaus.mojobuildnumber-maven-plugin1.4generateTimestampForBuildvalidatecreate-timestampyyMMddHHmmssorg.apache.maven.pluginsmaven-clean-plugin3.0.0falsetrue${src.preprocessed}com.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}${src.preprocessed}autodefault-fixinitializerunmain.gocom.igormaznitsajcp7.0.5preprocessGoSourcesvalidatepreprocessgotxtpngfalsetrue${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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-primitivemvn-golangPrimitive converting utilityExample of mvn-golang-wrapper usage to build the Primitive project: https://github.com/fogleman/primitive${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}truedefault-get-ugithub.com/fogleman/primitivedefault-buildgithub.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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-protobufmvn-golangProtobuf with Golang exampleExample of compilation and use of protobuf script.${project.build.directory}${file.separator}.protoGenwin-profilewindows.exe${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}auto${proto.gen.folder}get-protoc-get-gogenerate-sourcesget-ugithub.com/golang/protobuf/protoc-gen-godefault-get${basedir}${file.separator}go-dependencies.lstdo-runrunmain.gocom.github.os72protoc-jar-maven-plugin3.11.4generate-go-from-protogenerate-sourcesrungo${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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-termboxgomvn-golangTERMBOX-GO exampleExample of TERMBOX-GO https://github.com/nsf/termbox-go${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}autodefault-getgithub.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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTmvn-golang-example-termuimvn-golangTermUI exampleExample 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}bincom.igormaznitsamvn-golang-wrapper${main-project-version}truetrue
================================================
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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOT${project.build.directory}${file.separator}reports${file.separator}xunit.xmlmvn-golang-example-testing1.0.0-SNAPSHOTmvn-golangExample of TestingExample of usage of mvn-golang-wrapper for testing Golang project and XUnit report producing.${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}autogetTestDependenciesget-t./...default-getgithub.com/tebeka/go2xunitdefault-test-vtest-out-verbose.logtruemakeXUnitReporttestcustomgo2xunit-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.0com.igormaznitsamvn-golang2.3.11-SNAPSHOTmvn-golang-examplespom1.0.0-SNAPSHOT1.21.7examples-under-unixunixmvn-golang-example-nesmvn-golang-example-guimvn-golang-example-primitivemvn-golang-example-pluginexamplesSet of examples for mvn-golang-wrapperorg.apache.maven.pluginsmaven-clean-plugin3.0.0falsetrue${basedir}${file.separator}pkg${basedir}${file.separator}.jfrogmvn-golang-example-gui-gwtmvn-golang-example-preprocessingmvn-golang-example-fynemvn-golang-example-helloworldmvn-golang-example-helloworld-gomodmvn-golang-example-helloworld-multisrcmvn-golang-example-genbindatamvn-golang-example-goexamplemvn-golang-example-termuimvn-golang-example-logrusmvn-golang-example-gotermmvn-golang-example-multimodulemvn-golang-example-testingmvn-golang-example-gocuimvn-golang-example-cluimvn-golang-example-termboxgomvn-golang-example-maven-repositorymvn-golang-example-maven-module-mixmvn-golang-example-protobufmvn-golang-example-azul3d-mandelbrotmvn-golang-example-oak-shootertest-git-cvs
================================================
FILE: mvn-golang-examples/test-git-cvs/cvs-git-branch-master/pom.xml
================================================
4.0.0com.igormaznitsatest-git-cvs1.0.0-SNAPSHOTcvs-git-branch-master1.0.0-SNAPSHOTmvn-golangTest of loading main branchUTF-8${project.groupId}cvs-git-revision${project.version}mvn-golangtest${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}${src.preprocessed}autodefault-build-adefault-fixinitializedefault-gettruegithub.com/raydac/mvn-golang-cvs-testrunmain.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.0com.igormaznitsatest-git-cvs1.0.0-SNAPSHOTcvs-git-branch-v21.0.0-SNAPSHOTmvn-golangTest of loading non-main branchUTF-8${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}${src.preprocessed}autodefault-build-adefault-fixinitializedefault-gettruegithub.com/raydac/mvn-golang-cvs-testv2runmain.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.0com.igormaznitsatest-git-cvs1.0.0-SNAPSHOTcvs-git-custom1.0.0-SNAPSHOTmvn-golangTest of loading main branch with tagUTF-8${project.groupId}cvs-git-master-tag${project.version}mvn-golangtest${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}${src.preprocessed}autodefault-build-adefault-fixinitializedefault-getgithub.com/raydac/mvn-golang-cvs-testtruecheckout-Bmastertags/master_tag1runmain.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.0com.igormaznitsatest-git-cvs1.0.0-SNAPSHOTcvs-git-master-tag1.0.0-SNAPSHOTmvn-golangTest of loading main branch with tagUTF-8${project.groupId}cvs-git-branch-master${project.version}mvn-golangtest${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}${src.preprocessed}autodefault-build-adefault-fixinitializedefault-gettruegithub.com/raydac/mvn-golang-cvs-testmastermaster_tag1runmain.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.0com.igormaznitsatest-git-cvs1.0.0-SNAPSHOTcvs-git-revision1.0.0-SNAPSHOTmvn-golangTest of loading revisionUTF-8${project.groupId}cvs-git-branch-v2${project.version}mvn-golangtest${basedir}${file.separator}src${basedir}${file.separator}bincom.igormaznitsamvn-golang-wrapper${main-project-version}true${go.sdk.version}${src.preprocessed}autodefault-build-adefault-fixinitializedefault-gettruegithub.com/raydac/mvn-golang-cvs-test53dca7f87202ae2c34b897b80e5f7c1a9bed12adrunmain.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.0com.igormaznitsamvn-golang-examples1.0.0-SNAPSHOTtest-git-cvspomTest of 'get' for different identifiers in GIT repositorycvs-git-branch-v2cvs-git-revisioncvs-git-branch-mastercvs-git-master-tagcvs-git-custom
================================================
FILE: mvn-golang-hello/pom.xml
================================================
4.0.0com.igormaznitsamvn-golang2.3.11-SNAPSHOTcom.igormaznitsamvn-golang-hellojarMaven GoLang archetypeArchetype generates a sample mvn-golang projectpublishorg.apache.maven.pluginsmaven-assembly-plugin3.1.1make-distributiveinstallsinglefalse${project.artifactId}-${project.version}-${maven.build.timestamp}-distrsrc/assemble/distribution.xmlmake-bundleinstallsinglesrc/assemble/bundle.xmlcom.igormaznitsauber-pom${uber.pom}parentmodulesprofiles/profile/modulestrueupomorg.apache.maven.pluginsmaven-source-plugin3.1.0generate-sourcespackagejarorg.apache.maven.pluginsmaven-javadoc-plugin3.1.1generate-javadocpackagejar8org.apache.maven.pluginsmaven-gpg-plugin1.6sign-artifactsverifysign
================================================
FILE: mvn-golang-hello/src/assemble/bundle.xml
================================================
bundlefalsefalsejar${project.build.directory}/*.jar.asc*.jar*.pom*.pom.ascoriginal*.**.zip
================================================
FILE: mvn-golang-hello/src/assemble/distribution.xml
================================================
distrfalsefalsetar.gz${project.basedir}/projecttarget/texts/nbactions.xmlcatalog.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
================================================
main2.3.11-SNAPSHOT1.21.7resbinsrc**/*.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-golangHello GoLangSimple 'Hello World!' GoLang examplehttps://github.com/raydac/mvn-golang${gosdk}${dollar}{basedir}${dollar}{file.separator}packages.txt${gowrapper}UTF-8yyyyMMddHHmm3.0${year}The Apache Software License, Version 2.0http://www.apache.org/licenses/LICENSE-2.0.txtrepo${dollar}{mvn.version}windows-profilewindows.execlean 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}rescom.igormaznitsamvn-golang-wrapper${dollar}{go.wrapper.plugin.version}truedefault-buildhello.gogolang-runverifyrunhello.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.0com.igormaznitsamvn-golang2.3.11-SNAPSHOTcom.igormaznitsamvn-golang-hello-multijarMaven GoLang Multi-module archetypeArchetype generates a sample multi-module mvn-golang projectpublishorg.apache.maven.pluginsmaven-assembly-plugin3.1.1make-distributiveinstallsinglefalse${project.artifactId}-${project.version}-${maven.build.timestamp}-distrsrc/assemble/distribution.xmlmake-bundleinstallsinglesrc/assemble/bundle.xmlcom.igormaznitsauber-pom${uber.pom}parentmodulesprofiles/profile/modulestrueupomorg.apache.maven.pluginsmaven-source-plugin3.1.0generate-sourcespackagejarorg.apache.maven.pluginsmaven-javadoc-plugin3.1.1generate-javadocpackagejar8org.apache.maven.pluginsmaven-gpg-plugin1.6sign-artifactsverifysign
================================================
FILE: mvn-golang-hello-multi/src/assemble/bundle.xml
================================================
bundlefalsefalsejar${project.build.directory}/*.jar.asc*.jar*.pom*.pom.ascoriginal*.**.zip
================================================
FILE: mvn-golang-hello-multi/src/assemble/distribution.xml
================================================
distrfalsefalsetar.gz${project.basedir}/projecttarget/texts/nbactions.xmlcatalog.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
================================================
main2.3.11-SNAPSHOT1.21.7app-1/resapp-1/src**/*.goapp-1*.iml*.xmlapp-2/resapp-2/src**/*.goapp-2*.iml*.xmlcommon/rescommon/src**/*.gocommon*.iml*.xmlassembly-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-1mvn-golangApp-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}rescom.igormaznitsamvn-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-2mvn-golangApp-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}rescom.igormaznitsamvn-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-assemblytar.gzfalsefalse${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-resultspomAssembly results${dollar}{project.groupId}${artifactId}-app-1${dollar}{project.version}mvn-golang${dollar}{project.groupId}${artifactId}-app-2${dollar}{project.version}mvn-golangall-apps-${dollar}{project.version}org.apache.maven.pluginsmaven-clean-plugin3.0.0falsetrue${dollar}{basedir}${dollar}{file.separator}targetmaven-assembly-plugin3.1.0false${dollar}{basedir}/target${dollar}{basedir}/deploy.xmlcreate-archivepackagesingle
================================================
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}-commonmvn-golangCommon${dollar}{basedir}${dollar}{file.separator}src${dollar}{basedir}${dollar}{file.separator}bin${dollar}{basedir}${dollar}{file.separator}rescom.igormaznitsamvn-golang-wrapperdefault-buildnone
================================================
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}pomUTF-8${gosdk}${gowrapper}yyyyMMddHHmm3.0${dollar}{mvn.version}windows-profileWindows.exeassemblyassembly-resultscommonapp-1app-2clean packagecom.igormaznitsamvn-golang-wrapper${dollar}{go.wrapper.plugin.version}trueoff
================================================
FILE: mvn-golang-wrapper/pom.xml
================================================
4.0.0com.igormaznitsamvn-golang2.3.11-SNAPSHOTmvn-golang-wrappermaven-pluginmvn-golang-wrapper${mvn.version}joda-timejoda-time2.12.7com.igormaznitsameta-annotations${meta.version}com.igormaznitsameta-utils${meta.version}commons-iocommons-io2.16.1org.apache.maven.plugin-toolsmaven-plugin-annotations3.5providedorg.apache.mavenmaven-plugin-api${mvn.version}providedorg.apache.mavenmaven-core${mvn.version}providedorg.apache.maven.sharedmaven-artifact-transfer0.11.0org.slf4jslf4j-apicommons-codeccommons-codecorg.codehaus.plexusplexus-component-annotationscommons-iocommons-ioorg.apache.mavenmaven-compat3.0testorg.apache.maven.plugin-testingmaven-plugin-testing-harness2.1testorg.apache.maven.sharedmaven-verifier1.8.0testorg.zeroturnaroundzt-exec1.12commons-iocommons-ioorg.slf4jslf4j-apiorg.zeroturnaroundzt-zip1.17org.slf4jslf4j-apiorg.apache.commonscommons-compress1.26.2commons-codeccommons-codeccommons-codeccommons-codec1.17.1org.apache.commonscommons-lang33.14.0org.apache.httpcomponentshttpclient4.5.14commons-codeccommons-codecorg.slf4jslf4j-api1.7.36org.slf4jslf4j-nop1.7.36publishorg.apache.maven.pluginsmaven-assembly-pluginmake-distributiveinstallsinglefalse${project.artifactId}-${project.version}-${maven.build.timestamp}-distr
src/assemble/distribution.xmlmake-bundleinstallsinglesrc/assemble/bundle.xmlcom.igormaznitsauber-pom${uber.pom}parentmodulesprofiles/profile/modulestrueupomorg.apache.maven.pluginsmaven-source-plugingenerate-sourcespackagejar-no-forkorg.apache.maven.pluginsmaven-javadoc-plugingenerate-javadocpackagejar8org.apache.maven.pluginsmaven-gpg-pluginsign-artifactsverifysignsrc/main/filtered-resourcestrueorg.apache.maven.pluginsmaven-enforcer-plugin3.5.0enforce-no-duplicate-dependenciesenforceorg.apache.maven.*org.codehaus.plexusorg.codehaus.mojoextra-enforcer-rules1.8.0org.codehaus.mojoanimal-sniffer-maven-plugin1.24org.codehaus.mojo.signaturejava181.0ensure-java-1.8-class-librarytestcheckcom.igormaznitsameta-checker${meta.version}8truetrue
risky
*.HelpMojocheckorg.apache.maven.pluginsmaven-plugin-pluginmojo-descriptorprocess-classesdescriptorhelpmojo
================================================
FILE: mvn-golang-wrapper/src/assemble/bundle.xml
================================================
bundlefalsefalsejar${project.build.directory}/*.jar.asc*.jar*.pom*.pom.ascoriginal*.**.zip
================================================
FILE: mvn-golang-wrapper/src/assemble/distribution.xml
================================================
distrfalsefalsetar.gz${project.basedir}/projecttarget/texts/nbactions.xmlcatalog.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.LifecycleMappingmvn-golangorg.apache.maven.lifecycle.mapping.DefaultLifecycleMappingdefaultcom.igormaznitsa:mvn-golang-wrapper:${project.version}:cleancom.igormaznitsa:mvn-golang-wrapper:${project.version}:fixcom.igormaznitsa:mvn-golang-wrapper:${project.version}:getcom.igormaznitsa:mvn-golang-wrapper:${project.version}:generate
com.igormaznitsa:mvn-golang-wrapper:${project.version}:fmt
com.igormaznitsa:mvn-golang-wrapper:${project.version}:testcom.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.ArtifactHandlermvn-golangcom.igormaznitsa.mvngolang.utils.MvnGolangArtifactHandlermvn-golangfalsetrue
================================================
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:
*