ibm-messaging / mq-golang

Calling IBM MQ from Go applications
Apache License 2.0
168 stars 60 forks source link

Can't build #167

Closed Kohinor46 closed 2 years ago

Kohinor46 commented 3 years ago

Please include the following information in your ticket.

I followed the instructions described in the readme, but still get the error:

C:\Users\Professional> set GOROOT=c:\Go
C:\Users\Professional>set GOPATH=c:\Gowork
C:\Users\Professional>set CC=x86_64-w64-mingw32-gcc.exe
C:\Users\Professional>set CGO_CFLAGS=-Ic:\IBM-MQC-Redist-Win64\tools\c\include -D_WIN64
C:\Users\Professional>set CGO_LDFLAGS=-L c:\IBM-MQC-Redist-Win64\bin64 -lmqm
C:\Users\Professional>cd %GOPATH%
c:\Gowork>git clone https://github.com/ibm-messaging/mq-golang.git src/github.com/ibm-messaging/mq-golang
fatal: destination path 'src/github.com/ibm-messaging/mq-golang' already exists and is not an empty directory.
c:\Gowork>go install ./src/github.com/ibm-messaging/mq-golang/ibmmq
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
c:\Gowork>cd %GOROOT%
c:\Go>git clone https://github.com/ibm-messaging/mq-golang.git src/github.com/ibm-messaging/mq-golang
fatal: destination path 'src/github.com/ibm-messaging/mq-golang' already exists and is not an empty directory.
c:\Go>go install ./src/github.com/ibm-messaging/mq-golang/ibmmq
go install: version is required when current directory is not in a module
        Try 'go install ./src/github.com/ibm-messaging/mq-golang/ibmmq@latest' to install the latest version
c:\Go>go install ./src/github.com/ibm-messaging/mq-golang/ibmmq@latest
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
c:\Go>cd src/github.com/ibm-messaging/mq-golang/
c:\Go\src\github.com\ibm-messaging\mq-golang>go install ibmq
package ibmq is not in GOROOT (c:\Go\src\ibmq)

Can you please help me?

ibmmqmet commented 3 years ago

The module capabilities seem to have "evolved" at various times, but it didn't take long to put together a simple BAT file that starts from a clean slate:

@echo off
setlocal
set CC=x86_64-w64-mingw32-gcc.exe
set GOBIN=c:\gotest\bin
set GOPATH=c::\go
set GOROOT=
rmdir /q /s c:\gotest
mkdir c:\gotest
cd c:\gotest

mkdir src\github.com\ibm-messaging
cd    src\github.com\ibm-messaging

git clone git@github.com:ibm-messaging/mq-golang

cd mq-golang
go install samples\amqsput.go

cd c:\gotest
bin\amqsput Q1 QM1