If a constant was addressable, you could do
const x = 42
x = 23
fmt.Println(x) // 23
so a constant wouldn't be constant anymore. The minimum Go would need, to
make constants addressable would be some notion of const-pointers (that is,
pointers which don't allow modification of the pointee).
May
I guess that const will be substitute literally at compile time
for performance improvements. So there is not such variable in
run time.
Is it right?
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receivi
This package:
https://github.com/fatih/structs
Or, more generally, reflection or code generation. For your specific struct I'd
just add a method to return the map representation if that's what you need.
//jb
On 21 Aug 2017, at 06:42, Tong Sun
mailto:suntong...@gmail.com>> wrote:
To covert
https://play.golang.org/p/_rudr2_Vyc
I don't understand why any change done via vim is not reflected by
b.String().
I can see the changes in the tempfile.
Any help is appreciated.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe f
Zeus is a language neutral programmer's editor/IDE which includes support
for the Go language.
Go related changes new to this release include:
- Updated Go tools like goimports, gocode, gorename etc
- Updated Go delve debugger
- New feature allowing user input for tools
- More improv
To covert a Go struct, say,
type Person struct {
First string
Last string
}
into a map,
him["First"]=...
him["Last"]=...
One way to do it is to marshall it into json then unmarhall it back.
Is this the easiest way to do it? Is there any easier ways?
Thanks
--
You received this messa
I'd like to ask that everybody please stay polite on this thread. Thanks.
I agree that as a language proposal this requires more description.
To me the use case is not clear. I think I understand the basic idea,
but I do not understand the specific problems that it solves. For
example, it would
Thanks Paul, that's exactly what I really need to do.
On Tuesday, December 8, 2015 at 8:51:26 PM UTC-5, Paul Borman wrote:
>
> It really depends on what you are trying to do with the file name, as
> indicated by other posters. If you really are creating a command line that
> is to be directly
yes,all code were compiled with the same version.In my test , it can't be
happend anyway with same code.Reply is *int and do nothing in function
RPC1,it's very simple...
在 2017年8月21日星期一 UTC+8上午1:15:06,Tamás Gulácsi写道:
>
> Are both versions compiled with the exact same version ofGo?
--
You rece
Thanks!
In my view, whenever you are dealing with data, this (null situation) is
inevitable, which makes it so useful and so fundamental that it should be
considered as part of the future Go. Otherwise, you will see different
people doing different things, just like different people using differen
Are both versions compiled with the exact same version ofGo?
--
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.
For more op
Mutexes are good for a some low level tasks, and when you must have a
shared data structure with no clear owner. When in doubt, and when
designing your app, prefer communication over sharing, i.e. channels.
On Fri, Aug 18, 2017, 16:03 John Souvestre wrote:
> Interesting. So you think it is a ge
Tgis is what sql.NullInt64 does, or github.com/guregu/null .
--
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.
For more op
The first one is a type conversion, not the second.
On Thu, Aug 17, 2017, 14:59 Soumya Mukherjee wrote:
> Thank you both. I did not realize the latter syntax is that of a type
> conversion.
>
> On Thursday, August 17, 2017 at 1:43:45 PM UTC-4, Axel Wagner wrote:
>>
>>
>>
>> On Thu, Aug 17, 2017
On centos 6.5 , go version 1.8, stack:
panic: reflect: call of reflect.Value.Int on ptr Value [recovered]
panic: reflect: call of reflect.Value.Int on ptr Value
goroutine 52598456 [running]:
encoding/gob.catchError(0xc4209e10d0)
/root/go/src/encoding/gob/error.go:38 +0x95
panic(0xc40860, 0xc42606a
I'm a freshman. I went through the Tour of GO smoothly today, until I
encountered "Exercise: Web Crawler". The exercise is at here
https://tour.golang.org/concurrency/10 .
This exercise requires me to implement a concurrent crawler. I write a main
function like this:
> func main() {
> go
Thanks a lot. This is good :)
2017-08-20 14:09 GMT+05:30 Diego Medina :
> Hi,
>
> At work we have all of our deployment logic written in ansible and simply
> call an ansible playbook from jenkins (gitlab-ci in your case)
>
> Here is a sample project using ansible
>
> https://github.com/fmpwizard/
Pierre Durand,
Thanks for your concise and accurate answer.
在 2017年8月20日星期日 UTC+8下午6:22:47,Pierre Durand写道:
>
> Goroutine execution is not deterministic.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop
On Sun, Aug 20, 2017 at 4:34 PM, Tong Sun wrote:
> > You seem to refuse to answer even the simplest questions about your
> proposal, like "what's the difference to using pointers?".
>
> The answer lies exactly in your reply -- see how inconvenient it is
> currently, just to deal with a single var
Peter,
Got your point, thanks!
在 2017年8月20日星期日 UTC+8下午10:09:50,peterGo写道:
>
> Yp Xie,
>
> The Go scheduler is cooperative:
> https://en.wikipedia.org/wiki/Cooperative_multitasking
>
> You are using one processor: runtime.GOMAXPROCS(1). Force the main
> goroutine to yield: runtime.Gosched().
>
> You seem to refuse to answer even the simplest questions about your
proposal, like "what's the difference to using pointers?".
The answer lies exactly in your reply -- see how inconvenient it is
currently, just to deal with a single variable, whereas, what I'm dealing
with is,
Think of dealing
On Sun, Aug 20, 2017 at 4:08 PM, Tong Sun wrote:
> The
>
> fmt.Println(unmarshal(`{"foo": 3}`))
>
> prints a pointer instead of 3.
>
Yes, it is a pointer to an integer holding the value 3. If you want it to
format differently, implement fmt.Stringer.
>
> This is NOT what I'm asking for, despit
On Sun, Aug 20, 2017 at 10:06 AM, Wojciech S. Czarnecki
wrote:
Ah, so Go core team should puff, bow then break Go type system asap.
> Just because some sloppy coder in outer world may produce invalid data
> and present coder is too lazy to write proper validation for that?
>
This is in correct.
Yp Xie,
The Go scheduler is cooperative:
https://en.wikipedia.org/wiki/Cooperative_multitasking
You are using one processor: runtime.GOMAXPROCS(1). Force the main
goroutine to yield: runtime.Gosched().
For example,
https://play.golang.org/p/7HnogkMOOo
0: main
1: main
0: not main
2: main
1: n
The
fmt.Println(unmarshal(`{"foo": 3}`))
prints a pointer instead of 3.
This is NOT what I'm asking for, despite what you think. I think any
further explanation is pointless, since you disagree from the very first.
It'll be fruitless trying to make you look from other's view.
All I'm trying to
On Sat, 19 Aug 2017 08:05:34 -0700 (PDT)
Tong Sun wrote:
> Suggesting C# type syntax like "int*?*" so as to take nil as valid value.
Should 'int' type also support a 'NaN' then?
Nil (NULL) is *not* a number. Thats why it has its own keyword, one almost
universally associated with pointers only
On Sun, Aug 20, 2017 at 3:21 PM, Tong Sun wrote:
> On Sun, Aug 20, 2017 at 2:22 AM, Axel Wagner <
> axel.wagner...@googlemail.com> wrote:
>
> ii := new(int)
>> (*ii) = 3
>> (*ii)++
>>
>> Yes, it's not exactly the same syntax. It still demonstrates that what
>> you are suggesting creates, at best,
On Sun, Aug 20, 2017 at 2:22 AM, Axel Wagner
wrote:
ii := new(int)
> (*ii) = 3
> (*ii)++
>
> Yes, it's not exactly the same syntax. It still demonstrates that what you
> are suggesting creates, at best, very marginal benefit.
>
This is where I don't agree on.
var ii *int
>
This is what you are
I don't know if anyone cares about another attempt to brute-force generics
into Go 1, but I've written up a proof of concept here:
http://kothar.net/generic-adapters
This uses structs with func fields to emulate methods, and then generates
adapters at runtime between the typed functions and the
Are there any bindings to MPFR (similar to Gnu MP library)
Searched and could not find much on google or github.
MPFR has more functions than GMP which are handy.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group an
Goroutine execution is not deterministic.
--
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.
For more options, visit https:
PS: https://play.golang.org/p/ax_bsnEJ1Q
I added more goroutine to see what the result would be:
package main
import (
"runtime"
"fmt"
"sync"
)
func main() {
runtime.GOMAXPROCS(1)
wg := sync.WaitGroup{}
for i := 0; i < 5; i++ {
wg.Add(1)
fmt.Printf("%d: main\n", i)
go func (i int) {
fmt.Printf
Hi,
At work we have all of our deployment logic written in ansible and simply
call an ansible playbook from jenkins (gitlab-ci in your case)
Here is a sample project using ansible
https://github.com/fmpwizard/mrwilson/tree/master/ansible
it has all the roles, code, etc needed to start with a
Peter,
Yes, It's really, really annoying. See
https://github.com/golang/go/issues/21452.
Temporarily, I'm running
$ rm -f ../pkg/linux_amd64_shared/runtime/cgo.a && ./all.bash
Peter
On Sunday, August 20, 2017 at 12:57:43 AM UTC-4, Peter Arnt wrote:
>
> Greetings,
>
> I have been tracking the
34 matches
Mail list logo