This repository was archived by the owner on Mar 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Usage of errCheck
Igor Maznitsa edited this page Mar 3, 2017
·
2 revisions
It is possible to use the errCheck Golang tool with the plugin. For such cases the plugin provides 'custom' mojo and some adapt example of errCheck will look like
<plugin>
<groupId>com.igormaznitsa</groupId>
<artifactId>mvn-golang-wrapper</artifactId>
<version>${mvn.golang.version}</version>
<extensions>true</extensions>
<configuration>
<goVersion>${go.sdk.version}</goVersion>
</configuration>
<executions>
<execution>
<id>get-err-check</id>
<goals>
<goal>get</goal>
</goals>
<configuration>
<packages>
<package>github.com/kisielk/errcheck</package>
</packages>
</configuration>
</execution>
<execution>
<goals>
<goal>custom</goal>
</goals>
<phase>verify</phase>
<configuration>
<exec>errcheck</exec>
<buildFlags>
<flag>-blank</flag>
</buildFlags>
</configuration>
</execution>
</executions>
</plugin>
errCheck prints messages into standard stream and the result will look like
--- mvn-golang-wrapper:2.1.2:custom (default) @ golangIntegrateErrCheck ---
Prepared command line : bin/errcheck -blank
---------Exec.Out---------
main.go:13:8: file, _ := os.Open(path)
main.go:14:12: file.Write([]byte(data))
main.go:15:12: file.Close()
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------