如何使用Maven构建GO可执行文件

I have my Go source code, after go build, an executable is generated, which accepts some parameters to produce the output. Is there any way build the executable from maven build with any plugins?

You can just put your go build command into a shell script and run it with this plugin:

<plugin>
  <artifactId>exec-maven-plugin</artifactId>
  <groupId>org.codehaus.mojo</groupId>
  <executions>
    <execution>
      <id>Build Go binary</id>
      <phase>generate-sources</phase>
      <goals>
        <goal>exec</goal>
      </goals>
      <configuration>
        <executable>${basedir}/build-golang-app.sh</executable>
      </configuration>
    </execution>
  </executions>
</plugin>

Other option is this Golang plugin which is more feature-rich and specific to this problem. However for simple use cases I would still go with Shell script.

there is special plugin for maven to build golang projects, it is called mvn-golang-wrapper, there is some example Hello World project to show how to make simple project, a lot of examples can be found in the maven plugin project repository . The plugin allows work with maven central and it allows to share golang projects and their parts through maven repository, also it has special system to work with repositories and use versions through branch, tag and revision.