A nil map is like a regular map but it has nothing in it, cannot grow, and
takes zero space.
-rob
On Tue, Oct 17, 2017 at 5:31 PM, Christian Himpel
wrote:
> The spec defines: "A nil map is equivalent to an empty map except that no
> elements may be added." https://golang.org/ref/spec#Map_types
On Monday, 16 October 2017 01:53:25 UTC+1, Alex Buchanan wrote:
>
> Not a spanner at all.
>
> I think the Task Execution Schemas (TES) [1], which Funnel is based on, is
> a reinvention of DRMAA using technologies such as HTTP, REST, JSON,
> Protobuf. It's a pretty simple API and message type (
The spec defines: "A nil map is equivalent to an empty map except that no
elements may be added." https://golang.org/ref/spec#Map_types
You could return a nil map, if you have no elements to add, and a caller
would just need to read.
On Tue, Oct 17, 2017 at 7:02 AM Dan Kortschak
wrote:
> If you
If you only need the map conditionally, you need to declare it and then
conditionally make it.
```
var m map[string]int
if needMap {
m = make(map[string]int)
}
```
On Mon, 2017-10-16 at 21:52 -0700, Alex Dvoretskiy wrote:
> Hello, Golang Nuts!
>
> I have an interesting question about maps. W
Hello, Golang Nuts!
I have an interesting question about maps. What is the possible usage of
nil maps, which can be declared like "var m map[string]int"? You can't
write to nil map but have an option to create it.
Perhaps there is no use at all and this is just language specific feature?
Thank
Oh and also, FYI, os.Setenv("GOROOT") will *not* work, because
runtime.GOROOT() does *not* look at the current environment, it caches the
GOROOT from when the binary first started up... which makes sense, but its
docs confusingly say it looks at the environment, which is does, but not
the *curr
Hi,
A sequential read with `dd if=f64s.root of=/dev/null bs=32` takes around
8.5 secs (10.4 secs using read-data.go) on my machine. It would even take
up to 55 secs when bs = 1.
Also I observe that the MaxRSS of the C++ program is much bigger than the
Go version, so I suspect the C++ program pr
On Mon, Oct 16, 2017 at 8:17 PM, bronze man wrote:
>
> In the file /usr/local/go/src/syscall/dll_windows.go:300
>
> Is there any use case to use the always non-nil error obj?
>
> That is a strange design.I think I need to write my version of LazyProc.
>
> I can write something like following to wo
So I figured out I was looking for the error in the wrong place. The place
it was failing was in go/types when it tries to parse the files, using the
go/build.Default context. Which is created
here: https://github.com/golang/go/blob/master/src/go/build/build.go#L285
It uses either the GOROOT
In the file /usr/local/go/src/syscall/dll_windows.go:300
Is there any use case to use the always non-nil error obj?
That is a strange design.I think I need to write my version of LazyProc.
I can write something like following to work around this:
func IsSyscallErrorHappen(err error) bool{
if
On Mon, Oct 16, 2017 at 1:01 PM, Caleb Spare wrote:
>
> I have a server which is doing log processing and I'm trying to
> improve throughput. The bottleneck is access to a shared resource
> protected by a sync.Mutex. The issue is that even though there are
> nearly always worker goroutines blocked
Answering my own post:
On Friday, September 29, 2017 at 1:35:24 PM UTC-7, Traun Leyden wrote:
>
>
> Is it possible to abort running a test suite if one of the tests fails?
> In my case I'm running the test against multiple packages:
>
> go test github.com/path/...
>
>
> and if one test fails, i
Maybe dataln and out in your second example are around the wrong way?
--
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.
Fo
Try using the periph.io libraries; golang.org/x/exp/io/spi is no longer
maintained[1].
[1]https://github.com/golang/go/issues/22058#issuecomment-332390766
On Sun, 2017-10-15 at 21:01 -0700, Eugene Dzhurinsky wrote:
> Hello!
>
> I was trying to make the RF522 (RFID reader) to initialize properly
Good point, simple examples are almost never enough. I guess I was hoping
that we'd end up with 3-5 examples of a really simple case. Maybe I'll come
up with a more complex example.
I'm loading under ~5K files in parallel and possibly making an HTTP request
for each. I like the slice solution,
Yes. Sorry that is the second time I have managed to mess up this piece of
advice. I could try to blame my phone, but the reality is carelessness is to
blame.
> On 17 Oct 2017, at 09:47, Caleb Spare wrote:
>
> Dave, did you mean
>
> go test -p 1 ./...
>
> ?
>
>> On Mon, Oct 16, 2017 at 3:4
That fixed it!
I completely missed it because I was looking at the flag docs from "go test
--help". But I see that flag is documented in "go build --help"
On Monday, October 16, 2017 at 3:46:23 PM UTC-7, Dave Cheney wrote:
>
> The go tests packages in parallel (as distinct from running the t
Dave, did you mean
go test -p 1 ./...
?
On Mon, Oct 16, 2017 at 3:46 PM, Dave Cheney wrote:
> The go tests packages in parallel (as distinct from running the tests
> within a package in parallel) by default. This is controlled with the -p
> flag, which defaults to the number of cores visible t
The go tests packages in parallel (as distinct from running the tests within a
package in parallel) by default. This is controlled with the -p flag, which
defaults to the number of cores visible to the process.
Try go test -p ./...
--
You received this message because you are subscribed to th
I did a little more experimentation, and it looks like this is definitely
the case on Go 1.7.3 on OSX:
With this file system layout:
$ tree
.
├── package1
│ └── package1_test.go
└── package2
└── package2_test.go
2 directories, 2 files
And this test (and a similar test in package2_test.
If tests are run via:
go test -v github.com/org/repo/...
will there be any additional parallelism compared to running:
go test -v github.com/org/repo/package1
go test -v github.com/org/repo/package2
?
I'm asking because I'm seeing cases in the log output where the timestamp
on later tes
Well, that bug is closed as fixed and I'm using Go 1.9 which includes
the mutex fairness patch.
The problem I'm seeing isn't even unfairness among the users of a
mutex. The problem is the delay between unlock and some other
goroutine successfully acquiring the lock: the aggregate time where no
gor
This sounds like https://github.com/golang/go/issues/13086
On Mon, 16 Oct 2017, at 09:01 PM, Caleb Spare wrote:
> I have a server which is doing log processing and I'm trying to
> improve throughput. The bottleneck is access to a shared resource
> protected by a sync.Mutex. The issue is that even
I have a server which is doing log processing and I'm trying to
improve throughput. The bottleneck is access to a shared resource
protected by a sync.Mutex. The issue is that even though there are
nearly always worker goroutines blocked on Lock, only about 10% of the
time (in aggregate) is spent ru
No! no! please no! -- runs screaming from the room
On Wednesday, December 23, 2009 at 5:09:24 PM UTC, abiosoft wrote:
>
> I think there is need for ternary operator for neater codes.
>
> if a > b {
>c = a
> else {
> c = b
> }
>
> can easily be written as
>
> c = a > b ? a : b
>
> I think the
Prior to this recent post, this thread had been dormant for eight years. I
think the results speak for themselves and this topic does not need to be
revisited again.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this grou
I have a use case where I use multi line go generate, similar to
https://github.com/containous/traefik/blob/master/generate.go
//go:generate rm -vf autogen/gen.go
//go:generate mkdir -p static
//go:generate go-bindata -pkg autogen -o autogen/gen.go ./static/...
./templates/...
Would you recomm
The answer depends on whether you have just one value or many. For a single
value (sometimes known as a "future"), I tend to pair a chan of struct{}
with a value to be set. To make the value available, set it, then close the
channel. Readers wait on the channel, then read the value.
For a successi
You may want to try passing ldflag `-w` for darwin (`-s` for other
platforms) to strip that information from the compiled executable during
your testing in identifying the exact issue.
On Mon, Oct 16, 2017 at 1:33 PM Nate Finch wrote:
> There's no explicit use or inspection of GOROOT at all (asi
I'm inclined to say a Service would be better for Context access instead of
a noop Activity. You should be able to make the Service instantiate needed
resources or provide an implementation to instantiate those resources and a
method for communicating that logic in Go. If you don't want parallel
ve
There's no explicit use or inspection of GOROOT at all (aside from what I
just added to add GOROOT to the execution, which since it didn't help, I
may strip out). The code has no external dependencies aside from the
stdlib and stuff in its own repo. Obviously there's something which is
influe
As it stands now, we have a pure java wrapper application that simply starts a
subprocess with our pure go binary. I guess what you are saying is that our Go
application needs to become a library, rather than a process. Which is
complicated as I am not sure it can, as our cleanup assumes the pro
On Sunday, October 15, 2017 at 1:45:06 PM UTC-4, Alex Buchanan wrote:
>
> Show me the code! :)
>
> Here's mine: https://play.golang.org/p/ZwAlu5VuYr
>
The problem that sync.Map is intended to address is cache contention.
Unfortunately, it doesn't currently address that problem well for stores of
How were you intending to run the Go program?
iirc you'll need access to a Context that can only be provided by the
Dalvik VM, and that can only be instantiated via bytecode ran on the VM (so
use Java). The first entry point this is provided is Application.onCreate
when said class is declared in t
As mentioned in last paragraph here: https://golang.org/pkg/runtime/
GOARCH, GOOS, and GOROOT are recorded at compile time and made available by
constants or functions in this package, but they do not influence the
execution of the run-time system.
I'd first be inclined to think Mage source has d
Comparing values will be a lot cheaper with ints than strings. So if your
enum type is possibly used in hot loops, ints will be your friend. Also,
with ints, you can provide an ordering that differs from the lexical order
of the string values. For example, with an int, you can easily sort by
day-of
hi there,
I have this Go program that reads a binary file format coming from CERN.
I am trying to get it running almost as fast as its C++ counter-part.
the profile and code are here:
- https://cern.ch/binet/go-hep/rootio.cpu.pprof
- https://cern.ch/binet/go-hep/read-data.go
on my machine, I get
Thx. Btw, I don't know about any inlining help from the Go compiler when
you use iota or a string inside constants.
On Mon, Oct 16, 2017 at 6:16 PM, Diego Medina wrote:
> If it is something like weekdays (very few options), I don't see any
> issues with it. Stringer is great when as you go along
well now, that's weird. I just tried this in a minimal use case, compiled
a linux command on my mac and ran it on my ubuntu box that just did the
below... and it worked. Now I'm wondering what the difference is.
On Monday, October 16, 2017 at 10:55:02 AM UTC-4, Nate Finch wrote:
>
> Nope, I'm
Python resisted this for a while, depending on it's OR behavior. However,
the OR behavior has
a lot of critics and criticisms.
See https://www.python.org/dev/peps/pep-0308/
The if expression is really nice, and quite clear. I use it a lot. It
doesn't require null types or
other exotic feature
https://golang.org/pkg/io/#TeeReader
should help you out
best,
Rene
Am Sonntag, 15. Oktober 2017 22:36:36 UTC+2 schrieb st ov:
>
> A value sent through a channel can be read by only one reader, so once its
> read its no longer available to other readers is that right?
>
> In what ways can I pa
Hello!
I was trying to make the RF522 (RFID reader) to initialize properly.
After some research (involving Logic analyzer and hardware protocol dumps)
I realized that either I do something wrong with SPI, or it fails in
general somewhere at the interface/extra side.
I tried https://github.co
If it is something like weekdays (very few options), I don't see any issues
with it. Stringer is great when as you go along using your app, you may
need to add more values over time.
using iota and stringer is great when your list may be 15 or more items,
and keeping them updated becomes a chor
Nope, I'm wrong. It was an invalid test. It's still failing.
I'm going to raise this as an issue on the go tool.
IMO, this should work, and does not:
c := exec.Command("go", "build", "main.go")
c.Env = append(os.Environ(), "GOROOT="+goroot)
err := c.Run()
It should probably even work withou
The zsys_* files are automatically generated with the cgo tool so they
shouldn't be blindly copied. Perhaps you should try to generate on for
darwin/arm64 by running the cgo tool manually (perhaps with GOOS=darwin
GOARCH=arm64 set). Perhaps a golang.org/x/net maintainer knows better.
- elias
Very thanks, I got the library compiled after doing the fix. ( copy
zsys_darwin_amd64.go as zsys_darwin_arm64.go )
I notice that this socket platform go files content is defined by platform
and bit. so I think zsys_darwin_amd64.go and zsys_darwin_arm64.go should be
same.
The unlucky thing is
I was wrong. The root cause seem to be that the zsys_darwin_arm64.go (for
iOS arm64) is missing from golang.org/x/net/internal/socket. There is a
zsys_darwin_arm.go (for iOS arm), so it should be easy to add. You should
raise an issue on the golang bug tracker.
- elias
On Monday, October 16,
Thanks for the reply. But I can go get github.com/xtaci/kcp-go and use it
without problem.
So I need config something to support socket packing, Right?
I am new for golang And feel no way to go when seeing the error and I
didn't google the solution about how to fix it.
It's very appreciated if
I think this is a problem with the kcp-go package. Building the package for
darwin/arm64 gives me the same error:
$ GOOS=darwin GOARCH=arm64 go install github.com/xtaci/kcp-go
# golang.org/x/net/internal/socket
dev/go/src/golang.org/x/net/internal/socket/cmsghdr.go:9:10: undefined: cmsghdr
- el
The ACCU 2018 Call for Session Proposals is now open.
ACCU is a major UK (but nonetheless very international) conference on
programming and programming languages. Historically a large amount of C++ and
related content. Exactly the place for some good Go content.
ACCU organisation website: https:
50 matches
Mail list logo