[go-nuts] I cannot access global var from package. Any idea?

2018-11-16 Thread Juan Mamani
The sample code: // main.go in varglobal/ package main import( "fmt" "varglobal/db" ) var MyGlobalVar string ="Any value :)" func main(){ db.TryDisplayMyVar() } // db.go in varglobal/db/ package db import "fmt" func TryDisplayMyVar(){ fmt.Println("Val

Re: [go-nuts] I cannot access global var from package. Any idea?

2018-11-19 Thread Juan Mamani
t; > On Fri, Nov 16, 2018 at 2:40 PM Juan Mamani > wrote: > > > Why can not access global var MyGlobalVar? Any idea? > > Go has no global scope. It has universe scope, but you cannot define > anything there. `MyGlobalVar` has package scope. To access an exported > identif

[go-nuts] Issue using json with array

2018-12-18 Thread Juan Mamani
I'm not an expert but I do my best. Original json format required: { "pos": [{ "lp" : "WISE-12", "lat": "-33,43565400", "lon" : "-70,60552700", "speed" : "102" }] } Json autogenerated from: https://mholt.github.io/json-to-go/ (lazy style but it works. Even more when my boss is surrounding li

Re: [go-nuts] Issue using json with array

2018-12-19 Thread Juan Mamani
n works well. > https://play.golang.org/p/gnLe_Xi2-nb > > 2018年12月19日(水) 10:40 Juan Mamani : > >> I'm not an expert but I do my best. >> >> Original json format required: >> { "pos": [{ "lp" : "WISE-12", "lat": &

[go-nuts] Re: Issue using json with array

2019-02-19 Thread Juan Mamani
Thanks Victor! for now reading about.. El lunes, 4 de febrero de 2019, 10:56:53 (UTC-3), Victor Giordano escribió: > > Implemeting the Stringer interface could solve your problem > > El martes, 18 de diciembre de 2018, 22:40:45 (UTC-3), Juan Mamani escribió: >

Re: [go-nuts] Issue using json with array

2019-02-19 Thread Juan Mamani
amples in > the official docs: https://golang.org/pkg/encoding/json/#example_Marshal > > Hope that it helps :) > > El mié., 19 dic. 2018 a las 9:44, Juan Mamani ( >) escribió: > >> Thanks a lot for your reply!! You are right it's working. >> >> But, it coul

[go-nuts] Understind how to apply timeout using gouritine

2020-02-24 Thread Juan Mamani
Hi everybody, I've tried to adapt from from "Concurrency in Go by Katherine Cox-Buday" to understand how to apply timeout. But I don't get it. What I'm doing wrong? Here the code: package main import( //"fmt" "time" "math/rand" "log" )

Re: [go-nuts] Understind how to apply timeout using gouritine

2020-02-24 Thread Juan Mamani
Sorry}, here is the right code: ( just was the effect to b working til At 5:20am sleepy and lost) Expected behaviour is to end anonyimous func when 3s timeout is reached. // package main import( //"fmt" "time" "math/rand" "log" ) func main()

Re: [go-nuts] Understind how to apply timeout using gouritine

2020-02-24 Thread Juan Mamani
you to make sure it compiles. > > On Monday, February 24, 2020 at 10:01:01 AM UTC-5, Juan Mamani wrote: >> >> Sorry}, here is the right code: ( just was the effect to b working til >> At 5:20am sleepy and lost) >> >> Expected behav

Re: [go-nuts] Understind how to apply timeout using gouritine

2020-02-25 Thread Juan Mamani
e you need the timeout to follow >> the logic of your program, maybe package https://golang.org/pkg/context/ >> can help you. >> >> Hope this was useful! >> >> Le mar. 25 févr. 2020 à 00:45, Juan Mamani > > a écrit : >> >>> Sorry again. Well

Re: [go-nuts] Understind how to apply timeout using gouritine

2020-02-25 Thread Juan Mamani
eling doWork goroutine reach 3s... > 2009/11/10 23:00:03 doWork exited. > 2009/11/10 23:00:03 Done. > 2009/11/10 23:00:03 -End > > > What exactly did you expect to see other than that? > > On Monday, February 24, 2020 at 6:45:26 PM UTC-5, Juan Mamani wrote: >

Re: [go-nuts] Understind how to apply timeout using gouritine

2020-02-25 Thread Juan Mamani
/ > can help you. > > Hope this was useful! > > Le mar. 25 févr. 2020 à 00:45, Juan Mamani > a écrit : > >> Sorry again. Well, I followed your advice. Here is the link >> https://play.golang.org/p/7DigEVsKbdx >> How can I cancel goToSleep() when

Re: [go-nuts] Understind how to apply timeout using gouritine

2020-02-27 Thread Juan Mamani
Hi Brian, Thanks for your help. I will try out to implement your samples in my project. But still studying Goroutines and now Context. El miércoles, 26 de febrero de 2020, 10:41:26 (UTC-3), Brian Candler escribió: > > Perhaps slightly clearer: > https://play.golang.org/p/DDZxqaEFi-T > >

[go-nuts] Printf

2024-02-02 Thread Juan Mamani
Hi everybody! I was checking consistency behavior of fmt.Printf with some basic samples. And for my surprise never expected what I found. My context: OS: Linux, debian 8,9,10,11 Go version 1.21 What I was doing? Learning about fmt.Printf Expecting fmt.Printf behavior be the same output for any

Re: [go-nuts] Printf

2024-02-03 Thread Juan Mamani
Kurtis, thanks for your reply. El viernes, 2 de febrero de 2024 a la(s) 2:12:55 p.m. UTC-3, Kurtis Rader escribió: > I think you're being confused by the lack of newlines in the output. Add > "\n" to the end of the printf format. > > On Fri, Feb 2, 2024 at 8:56 AM

Re: [go-nuts] Printf

2024-02-03 Thread Juan Mamani
Luca, thanks for your answerr El viernes, 2 de febrero de 2024 a la(s) 3:06:17 p.m. UTC-3, Luca Pascali escribió: > you forgot the \n in the printf format string > > without it, next is written right after the end of the printf > > > Psk > > Il ven 2 feb 2024, 17:56