Hi all
I want to build a dynamic go library with gollvm.
How could I do this?
Thank you.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to golang-nuts+unsubscr...
Hi, I have the following program
package main
/*
#include
static void SayHello(const char* s) {
puts(s);
}
*/
import "C"
func main() {
C.SayHello(C.CString("Hello, World\n"))
}
I want to compile this program to LLVM IR with gollvm, the compilation
instruction is as follows:
llvm-goc
ve commands?
I made them up.
> rsc.io/quote is an example of
> repository to explain of how Go module works and not works if run without Go
> module-aware.
>
> https://github.com/golang/go/issues/26367
So `GO111MODULE=auto go get ` should work for any other packages
except rsc.io/qu
quote"
--
Regards,
Peng
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on
S to fix the performance problem.
net.ResolveIPAddr("ip4", addr)
--
Regards,
Peng
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to golang-nuts+unsubscr...@
Hi,
I see this ICMP example. But somebody says it is too old. What is the
current way to ping a target in go? Thanks.
https://gist.github.com/lmas/c13d1c9de3b2224f9c26435eb56e6ef3
--
Regards,
Peng
--
You received this message because you are subscribed to the Google Groups
"golang
inted out, Go does not use the C library.
>
> > On Feb 23, 2021, at 7:57 AM, Peng Yu wrote:
> >
> > This does not answer the question why net.Dial can not be made with
> > the same behavior as ping on MacOSX. If the C library behaves
> > differently on MacOSX and Li
wrote:
> It looks like the Go runtime implements its own DNS client on *unix
> platforms including OSX.
>
>> On Feb 22, 2021, at 11:40 PM, Peng Yu wrote:
>>
>> I don’t understand why ping does not have the same problem. Ping is not
>> based on C library?
>>
I don’t understand why ping does not have the same problem. Ping is not
based on C library?
On Mon, Feb 22, 2021 at 11:20 PM Ian Lance Taylor wrote:
> On Mon, Feb 22, 2021 at 9:11 PM Peng Yu wrote:
> >
> > I tried 1.16.
> >
> > $ go version
> > go versio
/etc/hosts?
On 2/22/21, Ian Lance Taylor wrote:
> On Mon, Feb 22, 2021 at 12:22 PM Peng Yu wrote:
>>
>> I run the following go program using net.Dial(). Depending on whether
>> I specify a local hostname (defined in /etc/hosts) or an IP. I get
>> very differen
:30 after
$ cat main.go
package main
import (
"net"
"log"
"os"
)
func main() {
dialAddr := os.Args[1]
log.Println("before")
_, err := net.Dial("tcp", dialAddr)
log.Println("after")
if err != nil {
log.Fatalln(err)
}
}
t;,"server.key",nil)
if err != nil {
log.Fatal("ListenAndServe: ",err)
}
}
--
Wesley Peng
wesleyp...@aol.com
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this gro
Hello,
How do I program with SSL to make a server listen on specific port which
accepts SSL transfer only?
Is there any guide for this since I have no experience on SSL socket
programming.
Thanks.
Wesley Peng
wesleyp...@aol.com
--
You received this message because you are subscribed to the
Hello community,
We are running a small website which allow users registration with their
email.
Many users use gmail's variants to sign up the site, as we know,
foo...@gmail.com is equivalent to below similar:
foo...@googlemail.com
foob...@googlemail.com
foo@gmail.com
foobar+...@gmail.com
Hello,
I tried to access RabbitMQ using this AMQP
library:https://github.com/streadway/amqp
I am not sure if this library get updated following the recent RMQ
version.Please suggest, thanks.
Wesley Peng
wesleyp...@aol.com
--
You received this message because you are subscribed to the Google
The code below:
package component
import "os"
type BaseicConfig struct{
}
func init() {
configDir := os.Getenv(constant.ProjectRootEnv)
if configDir == "" {
// run here.
log.Panic(constant.InvalidEnvVariables)
}
configPath := filepath.Join(configDir, constant.ConfigName)
if _, err := t
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ctriple/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ctriple/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS
this problem? Thanks.
P.S., here is one webpage, but it does not allow multiple workers.
https://blog.drkaka.com/batch-get-from-golangs-buffered-channel-9638573f0c6e
--
Regards,
Peng
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To u
Hi, I'd like to know what go concurrency is based on. For example, nodejs
is based on libev, making nodejs more efficient than using multithreading
to handle concurrency. What is go based on to make go concurrency more
effecient than multithreading?
--
Regards,
Peng
--
You received this me
This only applies to string but not other types like int.
On Sun, Jan 21, 2018 at 8:18 AM Arie van Wingerden
wrote:
> https://golang.org/src/strings/compare.go
>
> 2018-01-21 14:42 GMT+01:00 Peng Yu :
>
>> Hi, cmp() in python can return three values -1, 0, 1. Is there a
>
Hi, cmp() in python can return three values -1, 0, 1. Is there a
comparison function in golang that also return three values? Thanks.
https://docs.python.org/2/library/functions.html#cmp
--
Regards,
Peng
--
You received this message because you are subscribed to the Google Groups
"g
package mypkg
func Double(x int) int {
return Add(x, y)
}
--
Regards,
Peng
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to golang-nuts+unsubscr...
the term "exported" in the language specification.
>
> On Sat, Jan 20, 2018, 23:30 Peng Yu wrote:
>>
>> Why is only Add allowed? Where is this documented?
>
> --
>
> -j
--
Regards,
Peng
--
You received this message because you are subscribed to the G
Why is only Add allowed? Where is this documented? Thanks.
On Sat, Jan 20, 2018 at 2:49 PM, Jan Mercl <0xj...@gmail.com> wrote:
>
> On Sat, Jan 20, 2018 at 9:29 PM Peng Yu wrote:
>
> s/add/Add/g
>
>
> --
>
> -j
--
Regards,
Peng
--
You received this message
{
var value mypackage.Export
value.DoMagic()
fmt.Printf("%s", value)
fmt.Print(mypackage.add(1, 2))
}
$ go build main.go
# command-line-arguments
./main.go:12:13: cannot refer to unexported name mypackage.add
./main.go:12:13: undefined: mypackage.add
--
Regards,
Peng
--
Y
Hi, the concept of peekable iterator from python is very convenient.
Is there something similar in golang.
https://github.com/erikrose/more-itertools/blob/master/more_itertools/more.py#L134
--
Regards,
Peng
--
You received this message because you are subscribed to the Google Groups
"g
you want to write a length shorter than the slice, make the slice
> shorter. No, seriously...
>
> n, err := f.Write(d[:2])
>
> On Thu, 2018-01-18 at 17:04 -0600, Peng Yu wrote:
>> Hi,
>>
>> The following example shows how to write a byte slice to a buffer.
>>
noexpandtab tabstop=2:
package main
import (
"os"
"bufio"
"fmt"
)
func main() {
f := bufio.NewWriter(os.Stdout)
d := []byte{'s', 'o', 'm', 'e', '\n'}
n, err := f.Write(d)
f.Flush()
fmt.Pri
Thanks Dave & TL.
Regards,
Peng
在 2017年7月7日星期五 UTC+8上午9:44:55,Dave Cheney写道:
>
> This is a really interesting corner case of the syntactic sugar of the
> language.
>
> The first piece of sugar is that methods are just functions with a
> predefined first parameter, or to s
sable structs
- elements of addressable arrays
- elements of any slices (whether the slices are addressable or not)
- pointer dereference operations
Regards,
Peng
在 2017年7月7日星期五 UTC+8上午9:44:55,Dave Cheney写道:
>
> This is a really interesting corner case of the syntactic sugar of the
> langu
Hi,
In the chapter of "Method set" from "Go in Action", there is a description
as below "This shows that it’s not always possible to get the address of a
value.", the question is in which case does compiler not able to get the
address of a value and why, thanks.
01 // Sample program to show ho
I have a project that using golang.org/x/crypto/ssh, when I try to build
it, i usually do a go get ./... command(since it's easy to remember for
every project and shorter than go get golang.org/x/crypto/ssh), but then it
reports cannot find package "golang.org/x/net/context/ctxhttp".
It seems it
OK, now I actually get it. Just use a CounterWriter and return bytes num it
receives.
Such writer already exists in the std lib?
在 2016年12月16日星期五 UTC+8下午2:10:41,P Q写道:
>
> 2016년 12월 16일 금요일 오전 11시 5분 53초 UTC+9, Peng Wang 님의 말:
> Actually I don't really care about that, just don
OK, this point of view seems fair enough, I can take that.
But won't a normal user would expect that
// FooBuffer is some kind of buffer that fails randomly
w := FooBuffer(conn)
n ,err := m.WriteTo(w)
// if binary.Write returns error, n will be 0, buf actual bytes may not be
zero.
// n == w.Buffe
Then I should deal with the encoding of all the envelope fields. This
envelope seems to be simple, but i got a more complicated one in the real
dev works.
在 2016年12月16日星期五 UTC+8上午10:44:27,ma...@influxdb.com写道:
>
>
>
> On Thursday, December 15, 2016 at 6:05:53 PM UTC-8, Pen
When I run this command
GOOS=linux GOARCH=amd64 go build
I got this error
# crypto/sha256
asm: invalid instruction: 10572
(/Users/mike/workplace/go/src/crypto/sha256/sha256block_amd64.s:733)
VPSHUFD $250, Y7, Y2
asm: invalid instruction: 11157
(/Users/mike/workplace/go/src/crypto/sha256/sha
Use a proxy fix it.
On Wednesday, September 28, 2016 at 11:25:31 PM UTC+8, Peng Gao wrote:
>
> I just make a path and want to push it, I got this error
>
> git mail
> fatal: remote error: Access Denied (not available from your location)
> (running: git push -q origin HEAD:refs
I just make a path and want to push it, I got this error
git mail
fatal: remote error: Access Denied (not available from your location)
(running: git push -q origin HEAD:refs/for/master)
git-codereview: exit status 128
what's the reason?
--
You received this message because you are subscribed
On Tuesday, September 20, 2016 at 11:00:34 AM UTC+8, Peng Gao wrote:
>
> BTW in your test file, you can directly append your bytes slice.
> b1 = append(b1, vs...)
> and slicesEqual is redundant, bytes.Equal does test the length of two
> arguments
>
I mix up cap and len, just i
BTW in your test file, you can directly append your bytes slice.
b1 = append(b1, vs...)
and slicesEqual is redundant, bytes.Equal does test the length of two
arguments.
On Tuesday, September 20, 2016 at 6:56:55 AM UTC+8, Caleb Spare wrote:
>
> I'm trying to call a Go function from asm and I'm ha
I am doing a bench for my map-based cache.
the get implementation is the same
// Get an item from the cache. Returns the item or nil, and a bool
indicating
// whether the key was found.
func (c *cache) Get(k string) (interface{}, bool) {
c.mu.RLock()
// "Inlining" of get and Expired
item, found :
41 matches
Mail list logo