Hello i need help building first go files i am total noob dealing with go

Hello, my operation system is windows 8, I installed go to C:\Go\bin and in that location i find GO.EXE when i try to open it, it closes automatically i can see flash blink and some information, when i open it trought cmd prompt it still does the same thing. I would like to build thous files, thous files are custom not related to the issue. The readmed says: build: source/dar.go source/qvm.go source/QVMDisas.go source/qvmd.go gd source -o qvm. I tryed everything, but the go program dosent just work.

Hey, that’s not cool.

2 Likes

Why are you trying to open go.exe?, you need to setup your $GOPATH, read the installation page on http://golang.org

For testing if you have Go installed, after adding the path you installed Go onto your env variable, create the folder structure, $GOPATH/src and create a main.go file in it, after that, run the main.go file. If you want to check which version of Go you have in your machine, go version.

You have installed Go, after you have the $GOPATH created, all you need to do is add it to your environment variables. Read this up to understand the basics a bit before jumping to executing Go code. https://thewhitetulip.gitbooks.io/webapp-with-golang-anti-textbook/content/manuscript/02.1IntroductionGo.html.

Thnx for your replays, but i installed it properly i still dont have the compiler i dont undersand this program language how would i setup the gopath if i dont have compiler… it didnt install even the compiler…

Environment variable is a Microsoft Windows functionality. You can use setx program for setting up GOPATH environment variable.

I didn’t get it. What’s not cool?

There’s no need to tell the OP off because of their English skills. I’m sure there are many languages that you or I do not speek proficiently.

You got it all wrong. Honestly, I was not able to understand what he was asking that is why I asked him politely to fix the words. Even, my English is horrible.

Also, I am not a bully :slight_smile:

I think i have the compiler working, now when i use command "go build dar.go qvm.go QVMDisas.go qvmd.go, the compiler says cant load package dar.go and qvm.go, all they are in same folder. The program consist from thous four go files. Thous files what i am trying to build are here source codes https://github.com/b1naryth1ef/QVMGo/tree/master/source

This source code is sadly not arranged in the correct layout. To fix this you will have to do some setup on your side

  1. You must declare a GOPATH variable. Pick a place on your hard drive and set GOPATH to that location.

  2. Check out that code into a path inside GOPATH/src

  3. All go code is arranged in packages, the source you have violates this rule by putting source for several packages in one directory. You’ll have to move the source for the main command, package main files into their own directory.

  4. You’ll have to adjust the import path in the main package to import the source of the package. So if you have the library code in GOPATH/src/github.com/you/project, then the import path will be

    import “github.com/you/project

Additionally this document describes the basics of setting up a local environment to build go code.

https://golang.org/doc/code.html

  1. my gopath is set C:\Users\Iv\Desktop\QVM dissasemblerid\QVMGOWORKSPACE
  2. i created folders src, bin pkg inside QVMGOWORKSPACE
  3. i separated the go files inside src to subfolders like qvm there i put qvm.go and etc

Still if i try to build it it says:
go build dar.go qvm.go QVMDisas.go qvmd.go
GetFileAttributesEx dar.go: The system cannot find the file specified.

Make your GOPATH look like:

src
├── QVMDisas
│   └── QVMDisas.go
├── dar
│   └── dar.go
├── qvm
│   └── qvm.go
└── qvmd
    └── qvmd.go

then run

go install QVMDisas

This should create bin/QVMDisas, the executable you want, in your GOPATH.

Hopefully this is enough to get things working.

1 Like

Thanx now it created the executable like you sayed, problem solve, topic can be closed. I really appricate everyones help to solve my problem.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.