I'm trying to search Google but the keyword 'go' makes it difficult to find any useful answers.
Reading the http://golang.org/ page doesn't turn up anything useful either.
Right now, I have a simple function in my bash.rc:
function gogo() {
6g -o gotmp.tmp $@;
6l -o go.out gotmp.tmp;
rm -f gotmp.tmp;
}
However, this is no...
I know that Go is new and experimental, so I don't think that there already is one. But does anyone know one being worked on? I know that syntax highlighting is available for emacs, vim and xcode. But is there any integration into Eclipse,Netbeans or something like that?
...
As in, serializing JSON.
My current code doesn't work, and I think it must have something to do with the fact that _Map, _String, etc. are not public.
// vim:ft=go:ts=2
package main
import "json"
import "fmt"
import vector "container/vector"
func main() {
groceries := vector.New(0);
groceries.Push(&json._String{s:"Eggs"});
gro...
Hi,
I am not familiar with C-like syntaxes and would like to write code to find & replace, say, all 'A's to 'B's in a source string, say 'ABBA' with the Regexp package ReplaceAll or ReplaceAllString functions? How do I set up type Regexp, src and repl? Here's the ReplaceAll code snippet from the Go documentation:
// ReplaceAll returns...
I've only just recently learned about Google's programming language, Go. I've been intrigued by its offered support for concurrency, and set out to learn more about it. However, I went looking to see how Go implemented a particular feature of concurrency, and so far I haven't seen any evidence at all that this feature is there at all.
...
What is the difference between Go's multithreading approach and other approaches, such as pthread, boost::thread or Java Threads?
...
We've been talking about threads in my operating system class a lot lately and one question has come to my mind.
Since Go, (and Java) uses User-space thread instead of kernel threads, doesn't that mean that you can't effectively take advantages of multiple cores since the OS only allocates CPU time to the process and not the threads th...
Today a great friend of mine asked me what are the main differences between the newest Go language and Cython, which is a set of C-extensions for Python. I don't have much knowledge on Python, can anyone tell me why Go is better/worse than Cython?
Best regards,
Miguel Rentes
...
How can we reverse a simple string in Go? A Perl-like 'reverse' function does not seem to exist there.
...
Is it possible to create a Shared Library (.so) using Go?
UPDATED: created an "issue" for it.
...
Has anyone created a vim syntax file for the go language?
...
How does one interface a 'go' program with a C library?
I've been browsing go's source code but I still didn't figured it out. If someone has already done so, could you share, please?
UPDATED: Thanks to @fserb, I am posting some documentation from the 'go' sources:
Cgo enables the creation of Go
packages that call C code.
Us...
In Go, string is a primitive type, it's readonly, every manipulation to it will create a new string.
So, if I want to concatenate strings many times without knowing the length of the resulting string, what's the best way to do it?
The naive way would be:
s := "";
for i := 0; i < 1000; i++ {
s += getShortStringFromSomewhere();
}
r...
I'm trying to setup a multi package go project something like
./main.go
./subpackage1/sub1_1.go
./subpackage1/sub1_2.go
./subpackage2/sub2_1.go
./subpackage2/sub2_2.go
where main.go imports both subpackage1 and subpackage2. And subpackage2 imports subpackage1.
Ive been looking around for go makefile examples but I can't find anyth...
Hi
I am trying to compile go file using gccgo , i installed on my ubuntu 9.10 machine . when i compiled
$gccgo -c hello.go
hello.o file is generated , while trying to link and to form an executable
$gccgo -o hello hello.o
i get the following error
/usr/local/lib/gcc/i686-pc-linux-gnu/4.5.0/../../../libgo.so: undefined referen...
http://code.google.com/r/hectorchu-go-windows/source/list
If you could compile it successfully, I like to know the procedures of how to.
...
In day 2 of the go tutorial there is this exercise:
Why may it be useful to have a private type with exported fields?
For example:
package geometry
type point struct {
X, Y int;
name string;
}
Notice that point is lowercase and thus not exported, whereas the fields X and Y are uppercase and thus are. It seems to me, that in...
I want to know what is happening here.
There is the interface for a http handler:
type Handler interface {
ServeHTTP(*Conn, *Request)
}
This implementation I think I understand.
type Counter int
func (ctr *Counter) ServeHTTP(c *http.Conn, req *http.Request) {
fmt.Fprintf(c, "counter = %d\n", ctr);
ctr++;
}
From my und...
This function in pkg go/token makes me wonder why we need a method that returns the receiver itself.
// Token source positions are represented by a Position value.
// A Position is valid if the line number is > 0.
//
type Position struct {
Filename string; // filename, if any
Offset int; // byte offset, starting at 0
L...
I'm trying to put a vector variable inside a struct in Google's Go programming language. This is what I have so far:
Want:
type Point struct { x, y int }
type myStruct struct {
myVectorInsideStruct vector;
}
func main(){
myMyStruct := myStruct{vector.New(0)};
myPoint := Point{2,3};
myMyStruct.myVectorInsideStruct.Push(myPoint);
}
...