[go-nuts] go get tls handshake timeouts

2023-08-25 Thread Rich
When I run 'go get github.com/user/packge' I get a TLS Handshake :
go: module github.com/user/package: Get 
"https://proxy.golang.org/github.com/user/package/@v/list": net/http: TLS 
handshake timeout

So I set GOPROXY=direct

Now I get 
go: downloading github.com/user/package v0.5.0
go: github.com/user/package@v0.5.0: verifying module: 
github.com/user/package@v0.5.0: Get 
"https://sum.golang.org/lookup/github.com/user/package@v0.5.0": net/http: 
TLS handshake timeout   

  
 I know I didn't put a real package in -- because it happens with every 
package.  This also only happens when I am connected to my company VPN -- 
Company also uses proxies to get out. I would have better luck getting a 
river to flow uphill than for them to change their vpn or proxy policies. 
This used to work, until I had to reinstall my mac. 

I also can set different proxies to get around most of their corporate bs. 
Setting those proxies works for cloning a github repository, I can curl, 
wget -- it all seems to work just fine. I just cant run 'go get' 

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/cd8363f1-7407-466d-9017-c510a327613dn%40googlegroups.com.


Re: [go-nuts] Best IDE for GO ?

2023-08-19 Thread Rich
I used to hate it because  costs so darn much but goland is my ide. I dnt 
hate vs code, I've done vm and really like neovim nv chad, but at the end I 
just am more productive in goland. Even tried fleet but always come back to 
goland.for me the time saved is worth the price.

On Saturday, August 19, 2023 at 8:01:48 PM UTC-4 Justin Israel wrote:

> I usually hate this question and threads, because it's a bunch of people 
> arguing that their solution is superior. 
> There are always individuals stating how all they need is VIM or a plain 
> text editor with no syntax highlighting. 
> And then those like myself that feel very productive from the Jetbrains 
> ecosystem because of its superior performance in large codebases and 
> exceptional refactoring tools. No one is going to convince me that I would 
> be more productive learning all the vim hot keys and doing it in a terminal 
> without touching the mouse. It's just not my jam. And I wouldn't try to 
> convince those developers to switch away from vim if they are happy. I 
> prefer the visual feedback that I get from Intellij when refactoring and 
> making really complicated changes. Typing is typing and everything can do 
> that well to some degree with a language plugin. But things like the way my 
> personal choice lays out unit testing and making it easy to retry subsets 
> and see everything I need to see at once works for me. 
> I just don't get the point of these threads that try to narrow in on the 
> "best" ide. 
>
>
> On Sunday, August 20, 2023 at 9:17:35 AM UTC+12 Robert Engels wrote:
>
>> Reread what I wrote. Vim with autocomplete, etc is not a simple text 
>> editor with syntax coloring. 
>>
>> Still every major software engineering org in the world uses an ide (or 
>> multiple). I guess they don’t know what they are doing. 
>>
>> Btw, Googles current IDE is based on VSCode. 
>>
>> > On Aug 19, 2023, at 3:24 PM, Jan Mercl <0xj...@gmail.com> wrote: 
>> > 
>> > On Sat, Aug 19, 2023 at 10:06 PM Christian Stewart 
>> >  wrote: 
>> > 
>> >> Autocomplete and a go language server (gopls) add a ton of speed 
>> because you don't need to look up the docs for function and variable names. 
>> And go to definition improves speed navigating code significantly. 
>> > 
>> > - Using autocomplete and go-to-definiton does not require VSCode or 
>> > any other IDE. 
>> > - I do use autocomplete and go-to-definition. When I said I use no 
>> > IDE, that does not mean I don't use those features. 
>> > - The speed of typing/inputting code is overally a rather negligible 
>> > factor of the total time cost of developing/debugging and maintaining 
>> > any non-toy project. IOW, it's not a significant metric of 
>> > productivity. 
>> > 
>> >> But vim-go can do both, so why not just use it? 
>> > 
>> > Because I use govim? ;-) 
>> > 
>> > (But not for my large projects, gopls chokes on them still too often 
>> > to tolerate it.) 
>> > 
>> > -- 
>> > 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...@googlegroups.com. 
>> > To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/CAA40n-XusymW6gb5OnDa_7QWAWPFSkwKYQMYUm-d7419EZ%2BGkQ%40mail.gmail.com.
>>  
>>
>>
>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/43d8c37c-6153-4bb8-824e-714556446d10n%40googlegroups.com.


Re: [go-nuts] is running interactive or not

2023-06-08 Thread Rich
Thank you Cris and Kurtis -- For this project I am going with the switch 
option -- but I have other programs that I am going to replace the 
os.Getpid and os.Getppid trick with go-isatty.



On Thursday, June 8, 2023 at 3:22:29 PM UTC-4 Chris Burkert wrote:

> Hi, there are cases when this does not work. I tend to use a flag like 
> -batch or -noninteractive to trigger the correct behavior from within 
> scripts. Less magic, more control.
>
> Rich  schrieb am Do. 8. Juni 2023 um 20:19:
>
>> Hi, 
>>
>> I have a program I am writing that stops and asks the user for input, in 
>> this case it's a passphrase used to encrypt output.
>>
>>  I want the program to also be able to be used in a script, and if in a 
>> script use a predefined value as the passphrase. What I'd like to know is 
>> how to detect if running in a script or not.  I've tried something like 
>> this:
>> runPid := os.Getpid()
>> parPid := os.Getppid()
>> val := runPid - parPid //normally I check if runPid is > parPid in my 
>> code.
>> if val < 20 {
>> fmt.Println("Not running in a script")
>> }
>> This works, but only if the script ran quickly. Wondering if there is a 
>> better way to do this?
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/c8ae1be5-5a6b-45af-9249-ccdb02283d97n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/c8ae1be5-5a6b-45af-9249-ccdb02283d97n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/225e482c-535a-43bd-811f-e22ab540fb49n%40googlegroups.com.


[go-nuts] is running interactive or not

2023-06-08 Thread Rich
Hi, 

I have a program I am writing that stops and asks the user for input, in 
this case it's a passphrase used to encrypt output.

 I want the program to also be able to be used in a script, and if in a 
script use a predefined value as the passphrase. What I'd like to know is 
how to detect if running in a script or not.  I've tried something like 
this:
runPid := os.Getpid()
parPid := os.Getppid()
val := runPid - parPid //normally I check if runPid is > parPid in my code.
if val < 20 {
fmt.Println("Not running in a script")
}
This works, but only if the script ran quickly. Wondering if there is a 
better way to do this?

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/c8ae1be5-5a6b-45af-9249-ccdb02283d97n%40googlegroups.com.


Re: [go-nuts] Learning Go on internal server

2023-02-17 Thread Rich
Thanks Chris -- I've always run it from my mac, cross compile to Windows / 
Linux super easy, but many don't even have administrator rights to install 
it on their windows PC. I'll look into those proxies, but in general 
everything inside the company runs through corporate proxy servers, which 
isn't easy to get to from our tools servers.  Maybe I'll just turn off Go 
mod. 

On Thursday, February 16, 2023 at 3:19:41 PM UTC-5 Chris Burkert wrote:

> Go can be run on a regular Mac or PC. Maybe you don’t need a tools server 
> for this at all.
>
> However, in a corporate environment caching dependencies may be a good 
> thing. With modules this is done by running your own Go proxy. Take a look 
> at 
> https://github.com/gomods/athens
>  or 
> https://github.com/goproxy/goproxy.
>
> Rich  schrieb am Do. 16. Feb. 2023 um 17:48:
>
>> So, I've been writing go code for my company, and many have expressed an 
>> interest in learning Go. So what I want to do is create a learning 
>> environment for them on one of our 'tools' servers. The problem is that the 
>> tools server doesn't have good connectivity to the internet. So using go 
>> mod to download packages doesn't work. Is there a place I can download the 
>> package, put it on the server in a shared location so that go mod can pick 
>> up that it's already available?
>>
>> Thanks,
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/64642177-5c5c-41d8-b508-66318e429276n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/64642177-5c5c-41d8-b508-66318e429276n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/fa41f648-2ba6-4279-993f-0b15e9fdf007n%40googlegroups.com.


[go-nuts] Learning Go on internal server

2023-02-16 Thread Rich
So, I've been writing go code for my company, and many have expressed an 
interest in learning Go. So what I want to do is create a learning 
environment for them on one of our 'tools' servers. The problem is that the 
tools server doesn't have good connectivity to the internet. So using go 
mod to download packages doesn't work. Is there a place I can download the 
package, put it on the server in a shared location so that go mod can pick 
up that it's already available?

Thanks,

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/64642177-5c5c-41d8-b508-66318e429276n%40googlegroups.com.


Re: [go-nuts] liteide x38.2 released

2023-02-16 Thread Rich
Glad to see ya'll are still working on Liteide. I've used it in the past 
and for a while was my main Go IDE. I'll have to give it another try. 

On Monday, February 13, 2023 at 7:12:44 PM UTC-5 vfc wrote:

> Hi all, liteide x38.2 released!
>
> * update gotools to fix generic code lookup and code completion
> * refactoring the Go class view and outline to support generic views
> * update Delve debug plug-in, add disassembly view, and repair windows 
> process exit
>
> * LiteIDE Source code
> https://github.com/visualfc/liteide
>
> * Release downloads
> * https://github.com/visualfc/liteide/releases/latest
> * https://sourceforge.net/projects/liteide/files
> * [baidu pan](https://pan.baidu.com/s/1wYHSEfG1TJRC2iOkE_saJg) 
> password: jzrc
>
> ### 2023.02.14 Ver X38.2
> * LiteIDE
> * fix and update gotools & gocode
> * refactor astview outline
> * update dlv debugger plugin
> * GolangAst
> * new outline view by pos
> * support typeparams
> * LiteDebug
> * add disassemble view
> * DlvDebugger
> * fix generics func sync
> * fix dlv process exit on windows
> * refactor gorountines model
> * support disassemble model
> * LiteBuild
> * gosrc.xml TARGETNAME use BUILD_DIR_PATH
> * GolangEdit
> * support any and comparable
> * GolangCode
> * support any and comparable
> * gotools
> * types fix find obj field 
> * types fix object string
> * gotest fix run test file use -run mode
> * astview add new -outline for outline
> * astview add new -tp for typeparams
> * astview fix interface embedded type 
> * gocode
> * fix identifier comparable 
> * update lookup object
>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/9177f897-0ae0-47eb-ae01-b04b052afbfan%40googlegroups.com.


[go-nuts] Error Handling

2023-02-07 Thread Rich
In most of my code I create a function to handle errors. looks something 
like this:

func errorHandle(err error, str string, ex bool) {
 if err != nil {
  fmt.Printf("error: %s -- %v\n",str, err)
 }
 if ex {
os.Exit(1)
 }
}

This cleans up my code:
inFile, err := os.ReadFile("Mydata.txt")
errorHandle(err,"read mydata.txt",true) // The true will exit

So you see that I can exit the program when there is an error, what I want 
to know is if it's possible to do the same thing inside a function, to 
where I don't exit the program but return from the function:

func OpenFile( filename string) []byte {
inFile,err := os.ReadFile(filename)
errReturn(err, "read "+filname,true)

When there is an error it would return from the OpenFile function,

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/2eec0130-3deb-4f60-a13e-d7c9d132771dn%40googlegroups.com.


[go-nuts] TCP hand off?

2023-02-07 Thread Rich
I have a database that I want to be able to allow users to connect to. I 
didn't design this database, just trying to come up with a way to allow 
users to connect.  The way they set this database up is that there are 
three users, Read, Read/write, and Admin.  What I have done is write a tool 
that can authenticate a specific user such as jsmith234, he's a member of 
the Admin team, when using my cli tool it logs jsmith in using the admin 
user of the database. JDoe432 is a member of the read group, only gets read 
access, when they run the tool, the tool logs the user in with read-only 
access.

Users can query the database, get into a mysql shell, dump the database, 
restore the database, save tables as excel, or csv -- but only from the 
command line. What my users want to do is be able to use tools like mysql 
workbench.  I don't want to give them the database passwords as then you're 
constantly getting emails with people asking for the right creds, then 
you've got to look them up, give them the right user which is a pain.  I 
don't want to get into what happens when we reset the password which by 
corporate standards is every 90 days. Currently I only have to change it in 
the database and in my tool. 

My question is if there is a way to write a middleware app that can be run, 
so that the user logs in with SSH, the tool authenticates them, and then 
starts a port forward back to their system allowing mysql workbench to 
connect. 

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/4f0c20c2-b866-495e-a78b-b03977a556b7n%40googlegroups.com.


Re: [go-nuts] How to correctly use exec.Command and properly clean up all pipes

2023-02-07 Thread Rich
Not sure if this helps at all, but I've stopped using Go's exec and use 
bitfield's script command. You can do so much more with it than you can 
with the standard exec and it's shorter to implement than Go's exec.

https://github.com/bitfield/script


On Monday, February 6, 2023 at 5:43:45 PM UTC-5 lchri...@twilio.com wrote:

> Filed under https://github.com/golang/go/issues/58369.
>
> --
> Lucas Christian   
> Staff Software Engineer, Voice and SIP Connectivity
> On Fri, Feb 3, 2023 at 2:14 PM Ian Lance Taylor  wrote:
>
>> On Fri, Feb 3, 2023 at 1:48 PM Lucas Christian  
>> wrote:
>> >
>> > Thanks for the reply and confirmation—theoretical but we have had 
>> systems fail this way before (including the system this codebase will 
>> eventually be deployed on). Of course practically once that happens, the go 
>> process leaking one more file descriptor is probably the least of our 
>> worries.
>> >
>> > For completeness is there an issue tracker it would be worth filing 
>> this off to?
>>
>>
>> https://urldefense.com/v3/__https://go.dev/issue__;!!NCc8flgU!aclVyNiB3jXq50nLgI3WT74VmhVQaslq5Q_idqxqQ3QGe2HY-8Bx2A1dkZvNyGTYBD6wvTQF3tG0ng$
>>   
>> (which redirects to GitHub).
>
>
>>
>> Ian
>>
>>
>> > Lucas Christian
>> > Staff Software Engineer, Voice and SIP Connectivity
>> > On Fri, Feb 3, 2023 at 12:44 PM Ian Lance Taylor  
>> wrote:
>> >>
>> >> On Fri, Feb 3, 2023 at 12:38 PM 'Lucas Christian' via golang-nuts
>> >>  wrote:
>> >> >
>> >> > Apologies for reviving an old thread, but thought this might be the 
>> most efficient way to keep context.
>> >> >
>> >> > I'm looking at a similar issue Thomas encountered, but in this case 
>> I'm concerned about how to handle errors returned from 
>> StdoutPipe()/StderrPipe() and properly clean up after that. e.g.:
>> >> >
>> >> > cmd := exec.Command(myCommand, myArgs...)
>> >> >
>> >> > stdout, err := cmd.StdoutPipe()
>> >> > if err != nil {
>> >> > // log warning or bail out
>> >> > }
>> >> >
>> >> > stderr, err := cmd.StderrPipe()
>> >> > if err != nil {
>> >> > // log warning, if we bail out we will leak the os.Pipe 
>> allocated internally in cmd.StdoutPipe()
>> >> > }
>> >> >
>> >> > err = cmd.Start() // if this fails, it *will* clean up both pipes
>> >> >
>> >> > Looking at the source, both StdoutPipe() and StderrPipe() allocate 
>> os.Pipe()s internally. Since these methods return the reader I can 
>> technically close that one myself but the writer side of the pipe will 
>> presumably leak if cmd.Start() is never called. In my usecase it's probably 
>> an acceptable compromise to just complain to the log and move along with 
>> starting the process, but if my understanding is correct it feels like an 
>> omission in the language spec that there is seemingly no way to clean up a 
>> the pipes associated with a command that is never started.
>> >>
>> >> As a practical matter I wouldn't worry about it, as StdoutPipe and
>> >> StderrPipe should approximately never fail.  I think that the only way
>> >> they could fail would be if you hit the limit on the total number of
>> >> open file descriptors.
>> >>
>> >> If they do manage to fail, it's a fair point that there is no
>> >> supported way to close any earlier pipes.  Again it's unlikely to be a
>> >> practical problem as any lingering file descriptors will get closed by
>> >> the finalizer associated with each file descriptor.  But, yes, it
>> >> looks like a bit of a hole in the API.
>> >>
>> >> Ian
>>
>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/14152923-9531-430a-8108-0f40102106a4n%40googlegroups.com.


[go-nuts] Re: how to get the json line number when getting unmarshal errors?

2023-02-07 Thread Rich
I use a tool called hjson 
hjson/hjson-go: Hjson for Go (github.com) 

This not only lets you put comments into the code but many times can be 
used to fix json. Some of my tools the user has to generate a JSON payload 
then send it with my tool. I will take their json and run it through hjson 
first. It doesn't catch everything, but it has fixed quite a few json files 
that had little things like a missing comma. 

On Monday, February 6, 2023 at 6:22:29 PM UTC-5 dave wrote:

> I'm getting the error  
>
> panic: json: cannot unmarshal string into Go value of type 
> map[string]*json.RawMessage but it does not tell me which line or section 
> of my json is causing the issue. How can I see this?
>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/1366d8f7-a9d0-4c78-996f-9dae73e240abn%40googlegroups.com.


[go-nuts] Re: Achieving C/C++/Rust comparable performance with Golang

2022-12-16 Thread Rich
Too often people look at one benchmark -- speed in execution to determine 
what the best language is. Is Rust better than Go because it can run a 
benchmark faster?  The problem the original developers were trying to solve 
wasn't that C/C++ or other languages couldn't run fast enough, Ken Thompson 
wrote the original Unix kernel in Assembly after all, then went on to write 
B to make it easier to write for the new kernel. Dennis Ritchie modified B 
which became C and so on.  Google had large codebases meant long 
development times when that code needed to be changed to meet business 
requirements, which resulted in long compile times. So, from epic to user 
stories, to executable code was taking too long. 

Go is far more agile.  Epic to user stories, to executable code is much 
shorter giving more time for lab testing.  Of course, no program is ever 
'finished' upon release they'll be new business requirements, Epics, user 
stories and so on. When looking for a language, raw speed shouldn't be the 
only consideration. Go gives decent speeds, but ask yourself does the 
headache of C/C++ / Rust to get a program that may process each call 500ms 
faster worth it? I've tried C/ C++ / Rust --  Great languages, but I'll 
even use Go in place of Bash because I can get it done faster.
On Thursday, December 15, 2022 at 1:03:23 AM UTC-5 Jason E. Aten wrote:

> two comments
>
> a) use many cores. Suddenly your Go code runs circles around everything 
> else-- i.e. those
> languages you mention where doing multicore in a pain. The view
> that other languages are faster comes from an age long ago of single core 
> machines.
>
> b) rather than pre-mature optimization, the general wisdom, and my 
> specific heartfelt advice,
>  is to measure where the time and memory is actually being spent, and then 
> optimize from there.
>  Generally this will 100x speed your development time, and
> you may find it is plenty fast already, this is on top of the 10x - 20x 
> development speed over C++ that you
> already get with Go.  Should tuning be desired subsequently, when it comes 
> to profiling,
>  the Go tools are so vastly superior to anything else out there, that you 
> can easily find the 
> hot spots and focus your optimization with laser precision. This
> is much more productive than trying to guess in general and over 
> generalized terms about how a given 
> application could perform under different languages.
>
> On Wednesday, December 14, 2022 at 11:57:40 AM UTC-6 Kursk wrote:
>
>> Hi,
>> Go is a high performant garbage collected language, (considered) memory 
>> safe programming language, and as such its performance may not be 
>> comparable with other languages such as C/C++/Rust under certain 
>> application scenarios.
>>
>> I was wondering, how much of the Go language could be stretched (or 
>> ignored) to produce as close as possible performance results if for 
>> example, we write a program whose garbage collector have no work to do, 
>> assuming that we can pre-allocate all required heap space, or that we could 
>> somehow work around memory safety control points such as, index boundary 
>> checking, etc.
>>
>> - Which one those performance penalty points would exactly be?
>> - Which ones would be impossible to workaround?
>> - What instructions/operations would be generally speaking comparable?
>>
>> I know this is a very abstract and theoretical question, I am of course 
>> not expecting a conclusive/concrete answer to my questions but just some 
>> general answer, to increase my understanding about language performance 
>> while providing some pointers to continue my research on the topic.
>>
>> This will hopefully lead me to a better general understanding on where to 
>> seek for potential optimisation opportunities within the Go language itself 
>> vs scenarios where a port to C/C++/Rust would most likely be a better 
>> option.
>>
>> Thanks in advance.
>>
>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/9cee8bb2-3c63-4eb8-90df-917c592656a4n%40googlegroups.com.


[go-nuts] Re: Go Get Issues

2022-09-26 Thread Rich
After I posted this on Friday I saw about adding .git to the end, and that 
didn't work. Then it started saying:

repository.web.mycompany.com/st_nsres.git 
but package is
repository.web.mycompany.com/st_nsres 
<http://repository.web.mycompany.com/st_nsres.git>

Or something like that. What I had to do was delete the go.mod of 
repository.web.mycompany.com/st_nsres 
<http://repository.web.mycompany.com/st_nsres.git>, reinitialize go mod 
init repository.web.mycompany.com/st_nsres.git. I then pushed that, created 
a tag:
git tag "v0.1.1", then git push origin "v0.1.1". 

Then in the application I built that used that package I had to go get "
repository.web.mycompany.com/st_nsres.git". --THEN it started working.

When I look at the source code to go get  -- MAN the work the Go authors 
put into that is pretty amazing. Does anybody think it might be possible to 
write a go git command that might do the same things go get does but ... 
just for git?  In the days before go mod, I could just go into my goroot: 
go/src/repository.web.mycompany.com/ then do a git pull 
repository.web.mycompany.com/st_nsres.git. From there Go would look for it 
there and you wouldn't need to do a go get on it. I am not sure where it 
stores it today, if it were possible to somehow cache it manually like that?

Thanks for the help Christoph!!!


On Sunday, September 25, 2022 at 7:20:48 AM UTC-4 christoph...@gmail.com 
wrote:

> Hi Rich,
>
> I guess, you run into the behavior described here 
> <https://pkg.go.dev/cmd/go#hdr-Remote_import_paths>:
>
>
> *> To declare the code location, an import path of the form> *
> repository.vcs/path
> *> specifies the given repository, with or without the .vcs suffix, using 
> the named version control system, and then the path inside that repository.*
> *> (...)*
> *> If the import path is not a known code hosting site and also lacks a 
> version control qualifier, the go tool attempts to fetch the import over 
> https/http and looks for a  tag in the document's HTML . *
> (emphasis mine)
>
> So it seems the go get command does not recognize the import path to be a 
> Git repository. Otherwise it would have tried SSH, too.
>
> I would try changing the import path to 
> repository.web.mycompany.com/st_nsres.git to give go get a hint that the 
> import path is a Git repo.
>
> On Saturday, September 24, 2022 at 1:14:45 AM UTC+2 Rich wrote:
>
>> Sorry the last line was messed up.
>>
>> The error I get is:
>>  github.com/stretchr/testify/require: 
>> repository.web.mycompany.com/st_nsres@ v0.2.0: unrecognized import 
>> path "repository.web.mycompany.com/st_nsres":   https fetch: Get "
>> https://repository.web.mycompany.com/st_nsres?go-get=1":  Unable to 
>> connect
>>
>> It keeps trying to connect via https -- IT's SSH
>> Again I have ~/.gitconfig configured:
>>
>> [url "ssh://g...@internal.repository.web.mycompany.com:7999/ 
>> <http://g...@internal.repository.web.mycompany.com:7999/>"]
>>  insteadOf = https://repository.web.mycompany.com/
>>
>> And GOPRIVATE set to repository.web.mycompany.com
>> On Friday, September 23, 2022 at 4:59:44 PM UTC-4 Rich wrote:
>>
>>> I have been having a really hard time with Go Get It just isn't working. 
>>> We have a private Repositiory, that repository requires us to use SSH. 
>>> There is no option for using https.
>>>
>>> So, I've configured my git config "~/.gitconfig' 
>>>
>>> ```
>>> [url "ssh://g...@internal.repository.web.mycompany.com:7999/ 
>>> <http://g...@internal.repository.web.mycompany.com:7999/>"]
>>>  insteadOf = https://repository.web.mycompany.com/
>>> ```
>>> I have GOPRIVATE set
>>> ```
>>> export GOPRIVATE="repository.web.mycompany.com"
>>> ```
>>> Then when I use go get:
>>> ```
>>> repository.web.mycompany.com
>>> ```
>>>
>>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/de97c826-5a38-4943-ab2e-d0438829c5b0n%40googlegroups.com.


[go-nuts] Re: Go Get Issues

2022-09-23 Thread Rich
Sorry the last line was messed up.

The error I get is:
 github.com/stretchr/testify/require: 
repository.web.mycompany.com/st_nsres@ v0.2.0: unrecognized import path 
"repository.web.mycompany.com/st_nsres":   https fetch: Get 
"https://repository.web.mycompany.com/st_nsres?go-get=1": 
 Unable to connect

It keeps trying to connect via https -- IT's SSH
Again I have ~/.gitconfig configured:

[url "ssh://g...@internal.repository.web.mycompany.com:7999/ 
<http://g...@internal.repository.web.mycompany.com:7999/>"]
 insteadOf = https://repository.web.mycompany.com/

And GOPRIVATE set to repository.web.mycompany.com
On Friday, September 23, 2022 at 4:59:44 PM UTC-4 Rich wrote:

> I have been having a really hard time with Go Get It just isn't working. 
> We have a private Repositiory, that repository requires us to use SSH. 
> There is no option for using https.
>
> So, I've configured my git config "~/.gitconfig' 
>
> ```
> [url "ssh://g...@internal.repository.web.mycompany.com:7999/ 
> <http://g...@internal.repository.web.mycompany.com:7999/>"]
>  insteadOf = https://repository.web.mycompany.com/
> ```
> I have GOPRIVATE set
> ```
> export GOPRIVATE="repository.web.mycompany.com"
> ```
> Then when I use go get:
> ```
> repository.web.mycompany.com
> ```
>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/1582c370-7bc9-4674-bf49-4271fdcd7816n%40googlegroups.com.


Re: [go-nuts] Using golang variable in bash script Command

2022-09-23 Thread Rich
I do a lot of 'scripting' like things with Go - I found that using 
github.com/bitfield/script makes it a TON easier to run commands and you 
can pipe a command into another command, etc. Worth checking it out. 

On Tuesday, September 20, 2022 at 9:13:03 AM UTC-4 drro...@gmail.com wrote:

> I've done this for Linux and windows, as I regularly use both.  But I used 
> a different strategy.  I used the os functions to retrieve a slice of 
> strings that I can then filter and sort as I desire.  And I use the command 
> line to get the target string.
>
> github.com/drrob1/src/dsrt
> also in that repo is ds and rex that do this. dsrtr and dsrtre search all 
> subdirectories down from the current dir for what you describe.
> And I also sort the returned list by time w/ the most recent first.
> --rob solomon
>
> On Monday, September 19, 2022 at 12:08:24 PM UTC-4 princ...@gmail.com 
> wrote:
>
>> Thank you for the response.
>>
>> On Mon, Sep 19, 2022 at 8:26 PM Tamás Gulácsi  wrote:
>>
>>> No, please, no!
>>>
>>> Do NOT use bash with string interpolation if possible!
>>> Call find directly:
>>> *cmd, err := exec.Command("find", ".", "-name", search)*
>>> princ...@gmail.com a következőt írta (2022. szeptember 19., hétfő, 
>>> 12:04:32 UTC+2):
>>>
 then we don't need to add these commands 



 *scanner := bufio.NewScanner(os.Stdin)fmt.Println("Enter the substring 
 name")scanner.Scan()search:=scanner.Text()*
  right???

 we only need to keep this one
  *cmd, err := exec.Command("bash", "-c", fmt.Sprintf("find . -name 
 %s", search))*

 On Monday, September 19, 2022 at 3:31:12 PM UTC+5:30 Jan Mercl wrote:

> On Mon, Sep 19, 2022 at 11:50 AM PK  wrote:
>
> > search:=scanner.Text()
> > cmd1,err:=exec.Command("bash", "-c", "find . -name '*$search*'")
>
> Try something like this, not tested:
>
> cmd, err := exec.Command("bash", "-c", fmt.Sprintf("find . 
> -name %s", search))
>
> -- 
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/golang-nuts/fb987200-6678-443f-a0ab-884b5f77c324n%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/e0e1c0b2-c976-48ca-a0fa-0be3d81397ean%40googlegroups.com.


[go-nuts] Go Get Issues

2022-09-23 Thread Rich
I have been having a really hard time with Go Get It just isn't working. We 
have a private Repositiory, that repository requires us to use SSH. There 
is no option for using https.

So, I've configured my git config "~/.gitconfig' 

```
[url "ssh://g...@internal.repository.web.mycompany.com:7999/"]
 insteadOf = https://repository.web.mycompany.com/
```
I have GOPRIVATE set
```
export GOPRIVATE="repository.web.mycompany.com"
```
Then when I use go get:
```
repository.web.mycompany.com
```

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/d4e71bf9-f56d-46ac-803a-19f151ea44a4n%40googlegroups.com.


Re: [go-nuts] Application Monitoring

2022-08-17 Thread Rich
Right but Prometheus / Grafana is just a collector of the data output by 
runtime/metrics.   Where introscope / glowroot are configured at the java 
command line to and pull that information out of the java JVM.  Please 
correct me if I am wrong?

Thanks!!

On Tuesday, August 16, 2022 at 9:20:45 AM UTC-4 k.alex...@gmail.com wrote:

> Monitoring and observability are best practices regardless of what 
> language you use. We use a combination of Prometheus / Grafana and metrics 
> exported by runtime/metrics. We also include custom metrics tailored to our 
> application's use-case.
>
> Prometheus is not a standard Linux tool, but it is open source, 
> production-ready, language-agnostic, and widely used.
>
>
> On Mon, Aug 15, 2022, 8:01 AM Rich  wrote:
>
>> My company relies heavily on Java., Java apps we run require Introscope 
>> or Glowroot to monitor them and many outages have been solved using those 
>> tools.  If we were to write our apps in Go -- would we need an application 
>> monitoring tool, or would standard Linux tools suffice?
>>
>> Thanks-- Rich
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/f65a5920-3dde-495b-bc87-0e14f2512e86n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/f65a5920-3dde-495b-bc87-0e14f2512e86n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/f40c1e59-e0b3-44ff-822f-05a4b6dd20fbn%40googlegroups.com.


[go-nuts] Application Monitoring

2022-08-15 Thread Rich
My company relies heavily on Java., Java apps we run require Introscope or 
Glowroot to monitor them and many outages have been solved using those 
tools.  If we were to write our apps in Go -- would we need an application 
monitoring tool, or would standard Linux tools suffice?

Thanks-- Rich

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/f65a5920-3dde-495b-bc87-0e14f2512e86n%40googlegroups.com.


Re: [go-nuts] Go Mod SSH doesn't work

2022-08-05 Thread Rich
Thomas -- thank you for taking the time to reply.

This is one of the BIGGEST headaches coming from another language is Go 
Mod, and for a language that brags about being simple, fast to write, and 
fast to compile -- well I can't compile it if go mod can't download it -- 
even though it's right there in my GOPATH! Simple? The documentation on Go 
Mod is as extensive as 'Effective Go'. Usually this is where I turn off 
Gomod and just do without it.

On Friday, August 5, 2022 at 10:18:38 AM UTC-4 Thomas Bushnell, BSG wrote:

> I'm confused; while I haven't used that sort of setup, the documentation 
> does seem to address the case.
>
> https://go.dev/ref/mod#module-proxy
> https://go.dev/ref/mod#vcs
> https://go.dev/ref/mod#private-modules
>
> I can't tell from what you're saying whether you're using those facilities 
> or not, but that's where I'd look.
>
> On Fri, Aug 5, 2022 at 9:22 AM Rich  wrote:
>
>> Go modules have been frustrating working with internal sites that use 
>> ssh.  There is NO option to use HTTP. THere is no option to use a proxy. So 
>> I set up my go mod to contain 
>>
>> go.mod file:
>> require 
>> codecloud.web.mycompany.com/devgroup/mypackage.git v1.0.0
>>
>> .gitconfig file:
>>  [url "ssh://g...@codecloud.web.mycompany.com/ 
>> <http://g...@codecloud.web.mycompany.com/>"]
>> *insteadOf* = https://codecloud.web.mycompany.com/
>>
>> go env:
>> go env -w GOPRIVATE=codecloud.web.att.com/*
>> (I've tried the full path here and I get the same error)
>>
>> ERROR:
>> go mod download codecloud.web.att.com/devgroup/mypackage
>> go: codecloud.web.att.com/devgroup/mypack...@v1.0.0 
>> <http://codecloud.web.att.com/devgroup/mypackage.git@v1.0.0>: reading 
>> codecloud.web.att.com/devgroup/mypackage.git/go.mod at revision v1.0.0: 
>> unknown revision v1.0.0
>>
>> I really don't get why this is so $#@! hard and not some simple setting 
>> in go.mod like this:
>>
>> require 
>> private git@ssh://codecloud.web.mycompany.com/devgroup/mypackage 
>> v1.0.0 
>>
>> -- but it's broken, it doesn't work, and I am out of what to google next. 
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/cf2ef966-3bc5-4e81-89be-c130c624786fn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/cf2ef966-3bc5-4e81-89be-c130c624786fn%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/3190415b-0dcb-4421-9c55-c2923e22e9b2n%40googlegroups.com.


[go-nuts] Go Mod SSH doesn't work

2022-08-05 Thread Rich
Go modules have been frustrating working with internal sites that use ssh.  
There is NO option to use HTTP. THere is no option to use a proxy. So I set 
up my go mod to contain 

go.mod file:
require 
codecloud.web.mycompany.com/devgroup/mypackage.git v1.0.0

.gitconfig file:
 [url "ssh://g...@codecloud.web.mycompany.com/"]
*insteadOf* = https://codecloud.web.mycompany.com/

go env:
go env -w GOPRIVATE=codecloud.web.att.com/*
(I've tried the full path here and I get the same error)

ERROR:
go mod download codecloud.web.att.com/devgroup/mypackage
go: codecloud.web.att.com/devgroup/mypackage.git@v1.0.0: reading 
codecloud.web.att.com/devgroup/mypackage.git/go.mod at revision v1.0.0: 
unknown revision v1.0.0

I really don't get why this is so $#@! hard and not some simple setting in 
go.mod like this:

require 
private git@ssh://codecloud.web.mycompany.com/devgroup/mypackage v1.0.0 

-- but it's broken, it doesn't work, and I am out of what to google next. 

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/cf2ef966-3bc5-4e81-89be-c130c624786fn%40googlegroups.com.


[go-nuts] Microsoft Adaptive card

2022-07-18 Thread Rich
I need to be able to render adaptive cards, we have tons of adaptive cards 
that we already use but because the system that rendered them is going away 
-- I've got to figure out how to render them myself. I've googled and 
couldn't find anything, was hoping someone here might know of a way to 
render the cards. I do see there is a go package to create them, but not to 
render them.

Thanks, 

Rich

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/8b77d8ef-f473-4637-af7d-d802dd0aff40n%40googlegroups.com.


Re: [go-nuts] cmd/trace: Indirect reporting of OS Latency?

2022-02-12 Thread Rich Moyse
Robert, thanks for your reply - especially the link to *perf sched*!  I 
plan to run the go program on Windows physical machine.  I'll post my 
results once done.

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/18ebe8c8-4741-4e0f-93a1-0c316444588an%40googlegroups.com.


[go-nuts] cmd/trace: Indirect reporting of OS Latency?

2022-02-11 Thread Rich Moyse
*TLDR*

I’d be grateful if someone could either confirm or dismiss the effect of 
OS, go runtime, and/or Hypervisor latency on the output of a goroutine 
trace.  The trace report displays empty gaps of 3-14ms where expected 
periodic goroutines should execute, as there’s a goroutine triggered by 
each 1ms timer tick.  Attempts to select items within these gaps return only 
five “counter” items - nothing else.  Those counter items suggest that 
nothing is running.  Perhaps external preemptive behavior interrupts the 
running go process, thereby suspending the go runtime, causing these gaps?  
If so, can these trace gaps be attributed to OS and/or Hypervisor scheduler 
preemption?

Although a recent (2/4/2022) go-nuts summary mentions a post to the thread: 
Issues 
when using time.Ticker microsecond duration 
, 
whose other posts discuss a range of causes, including OS induced latency, 
this thread attempts to understand how external latency sources affect the 
trace report.

In addition to the problem description below, the go code and trace screen 
images are available via this gist 
 
while the trace file is available here 
.
  
The go program was compiled first using 1.18beta1 and later with 1.17.  
It’s running in a 16.04 Ubuntu Desktop VM that’s managed by Hyper-V on a 
physical machine running Windows 10 Pro.  The go program limits itself to 
the interplay between two goroutines: a single sending goroutine and a 
single receiving one.

These goroutines share an unbuffered channel.  The sender is only throttled 
by the capacity of the receiver to consume its messages while the receiver 
is gated by a timer that ticks in 1ms 
 intervals.  The sending code 
executes in ~600ns  then blocks 
waiting for the receiver.  The receiver executes in ~8us 
, starting after the ticker 
expires until it's blocked waiting for the timer’s next tick.  Due to their 
speedy execution, the go runtime scheduler never intervenes to preemptively 
interrupt either goroutine.  Moreover, the garbage collector doesn’t run 
because only this same pair of goroutines are active and the message 
communicated between them is an empty structure.

In general the regular rhythm of the receiver’s timer appears in the 
“Goroutine analysis” view of the trace report as evenly spaced markings at 
nearly one 1ms intervals.  However, these ruler-like markings are 
sporadically absent resulting in gaps between 3-14ms.  During these gaps 
neither the receiving goroutine nor its coupled sender execute.  When 
selecting the rectangular gap area only “5 items'' are reported as 
selected. These 5 items displayed by the “Counter Samples (5)” tab indicate 
that no goroutines are “Running”, nor are there “Runnable” ones.  Here are 
all the counters reported by the selected gap appearing at time: ~502ms 
into the trace report:  *Counter*  *Series  *   *Time  
 Value*

Goroutines GCWaiting 502.3296180004 0

Goroutines Runnable 502.3296180004 0

Goroutines Running 502.3296180004 0

Threads InSyscall 501.252301 0

Threads Running 501.252301 1

Since the program was running trace, to collect the data needed to produce 
its report, perhaps the trace itself induced a measure of go runtime 
latency?  To eliminate this potential latency source, the trace package and 
its associated http server goroutine were eliminated.  Instead, latency 
events were directly detected and reported by the receiving goroutine.  
This goroutine computed the latency between timer ticks by remembering the 
prior timer value and subtracting it from the newly provided one.  It 
outputted, via fmt.Print, a message whenever the computed latency exceeded 
5ms.  It’s source, main_latencycompute.go 

 
is provided by the same gist 
.

Before running the newly altered program, I half thought removing the 
overhead of collecting trace data would eliminate the latency gaps depicted 
in its reporting.  However, after a bit of waiting, the altered program 
began issuing sporadic latency messages.  Furthermore, the activities of 
opening a new terminal window or moving existing windows with a mouse, 
caused the altered program to seemingly generate latency messages with 
greater frequency.  On noticing this behavior it seemed likely to me that 
the empty gaps depicted by the trace report represent latency introduced by 
the OS scheduler, as it preemptively stops and then restarts the go program.

After 

[go-nuts] Add to existing Go Package

2022-01-17 Thread Rich
What I want to do is extend the go standard log package. I am using log to 
write logfiles, but there are two things with it I need to extend. 

The first is a 'Format' string, which allows me to change the time format 
string log uses.

The second is to be able to print to both logfile and stdout., This is 
useful when you're starting your server, and you want some of the output to 
go directly to stdout. I use this so that with one line I can print the 
same line to stdout as I print to my log file.

lgOut.Tprintf("Server Version: %s Started and listens on:  %s:%s, ", 
server.Version, server.Address, server.Port)

That would print to both stdout and to the logfile lgOut is configured for.
Ex: 
20220117-13:45 | Server Version 1.0.1 Started and listens on 127.0.0.1:8080"
 
What I am worried about is that my version of log will diverge from the Go 
standard log package.   Is there a way to extend an existing package so 
that my adds to the log package pulls from whatever happens to be the most 
current version of log?

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/60ae5b79-b1b9-451d-b8bb-d3726f22ab71n%40googlegroups.com.


Re: [go-nuts] Trace explicit goroutine function names replaced by synthetic ones 1.18beta1

2022-01-14 Thread Rich Moyse
Ian:

Appreciate your guidance.  

Created issue #50622 <https://github.com/golang/go/issues/50622>.

Rich
On Friday, January 14, 2022 at 1:12:38 PM UTC-5 Ian Lance Taylor wrote:

> On Fri, Jan 14, 2022 at 10:03 AM Rich Moyse  wrote:
> >
> > When viewing a trace produced by 1.18beta1, the goroutine function names 
> reflect synthetically generated ones typically assigned to 
> anonymous/closure functions.
> >
> > For example, a function explicitly named: "msgSend" in the "main" 
> package appears on the trace "/goroutines" page as: "main.main.func1" 
> instead of "main.msgSend". This issue also occurs when viewing specific 
> goroutine events selected from the trace timeline. In this situation, the 
> event "Title" field again reflects "main.main.func1" instead of 
> "main.msgSend".
> >
> > I noticed this issue when comparing the output of a trace produced by 
> the 1.17 "go tool trace" versus the one generated by 1.18beta1.
> >
> > Has anyone else notice this issue? Am I missing some configuration 
> setting that would configure the "go tool trace" to display explicit names 
> instead of synthetic ones?
> >
> > The following github links provide the mentioned:
> >
> > go source,
> > 1.17 trace file,
> > 1.18beta1 trace file.
>
> That doesn't seem like an intended change. Please open an issue for
> this at http://go.dev/issue. Thanks.
>
> Ian
>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/7da8cd8a-8b43-4b60-b55b-beccbb504dd6n%40googlegroups.com.


[go-nuts] Trace explicit goroutine function names replaced by synthetic ones 1.18beta1

2022-01-14 Thread Rich Moyse
When viewing a trace produced by 1.18beta1,  the goroutine function names 
reflect synthetically generated ones typically assigned to 
anonymous/closure functions.

For example, a function explicitly named:  "*msgSend*" in the "main" 
package appears on the trace "/goroutines" page as: "*main.main.func1*" 
instead of "*main.**msgSend"*.  This issue also occurs when viewing 
specific goroutine events selected from the trace timeline.  In this 
situation, the event "Title" field again reflects "*main.main.func1*" 
instead of "*main.msgSend*".

I noticed this issue when comparing the output of a trace produced  by the 
1.17 "go tool trace" versus the one generated by 1.18beta1.

Has anyone else notice this issue?  Am I missing some configuration setting 
that would configure the "go tool trace" to display explicit names instead 
of synthetic ones?

The following github links provide the mentioned:

   -  go source 
   

   ,
   - 1.17 trace file 
   

   ,
   - 1.18beta1 trace file 
   

   .
   

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/85b946dc-6afe-4b38-a2a8-4e9a02ff0e5bn%40googlegroups.com.


[go-nuts] Re: setuid root

2021-09-20 Thread Rich
Thanks -- that worked.

On Monday, September 20, 2021 at 2:11:21 PM UTC-4 Tamás Gulácsi wrote:

> chmod 4755 is not enough. Your binary must be owned by root, to run root - 
> setuid means "run as owner".
>
> Rich a következőt írta (2021. szeptember 20., hétfő, 19:54:33 UTC+2):
>
>> Yes. I tried running an exec: cmd=exec.Command("whoami") and it came as 
>> my user id not root.  But to set the permissions I'd run: 'chmod 4755 
>> myapplication'
>>
>> On Monday, September 20, 2021 at 11:20:39 AM UTC-4 Tamás Gulácsi wrote:
>>
>>> You mean "chown root app; chmod 4755 app" ?
>>>
>>> Rich a következőt írta (2021. szeptember 20., hétfő, 16:57:38 UTC+2):
>>>
>>>> I am trying to create a go program so that I can peform an action that 
>>>> is more complex than the example I have below. I can't give sudo right so 
>>>> run the application due to some policy we have at work that certain groups 
>>>> can only have read permissions. The company also have a policy that states 
>>>> any new directory / file is set with restrictive permissions. What I 
>>>> wanted 
>>>> to do is create a program that runs as root. (Like ping runs as root) but 
>>>> it doesn't seem to work.
>>>>
>>>> package main
>>>>
>>>> import (
>>>> "fmt"
>>>> "os"
>>>> "os/exec"
>>>> )
>>>>
>>>> func main() {
>>>>   cmd:=exec.Command("chmod","770", "/opt/app/mnt/mydirectory")
>>>>   cmd.Stdout = os.Stdout
>>>>   cmd.Stderr = os.Stderr
>>>>   err:=cmd.Run()
>>>>   if err != nil {
>>>> fmt.Println("ERROR:", err)
>>>>   }
>>>> }
>>>>
>>>> When I compile, then do a chmod 4755, and run it. I get a permissions 
>>>> denied. Looking for why this would be?
>>>>
>>>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/9a3d069a-dcb4-41fe-8ab7-ae5c7141e5e1n%40googlegroups.com.


[go-nuts] Re: setuid root

2021-09-20 Thread Rich
OK -=- My mistake.  When you setuid a program it sets the user to the owner 
of the file. So I owned the file, so it would run as me. When I did a chown 
root myapplication -- it runs like it should. Thanks everyone for the help.

On Monday, September 20, 2021 at 1:54:33 PM UTC-4 Rich wrote:

> Yes. I tried running an exec: cmd=exec.Command("whoami") and it came as my 
> user id not root.  But to set the permissions I'd run: 'chmod 4755 
> myapplication'
>
> On Monday, September 20, 2021 at 11:20:39 AM UTC-4 Tamás Gulácsi wrote:
>
>> You mean "chown root app; chmod 4755 app" ?
>>
>> Rich a következőt írta (2021. szeptember 20., hétfő, 16:57:38 UTC+2):
>>
>>> I am trying to create a go program so that I can peform an action that 
>>> is more complex than the example I have below. I can't give sudo right so 
>>> run the application due to some policy we have at work that certain groups 
>>> can only have read permissions. The company also have a policy that states 
>>> any new directory / file is set with restrictive permissions. What I wanted 
>>> to do is create a program that runs as root. (Like ping runs as root) but 
>>> it doesn't seem to work.
>>>
>>> package main
>>>
>>> import (
>>> "fmt"
>>> "os"
>>> "os/exec"
>>> )
>>>
>>> func main() {
>>>   cmd:=exec.Command("chmod","770", "/opt/app/mnt/mydirectory")
>>>   cmd.Stdout = os.Stdout
>>>   cmd.Stderr = os.Stderr
>>>   err:=cmd.Run()
>>>   if err != nil {
>>> fmt.Println("ERROR:", err)
>>>   }
>>> }
>>>
>>> When I compile, then do a chmod 4755, and run it. I get a permissions 
>>> denied. Looking for why this would be?
>>>
>>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/192b7b23-8eed-4397-a5e3-16a63f91b2afn%40googlegroups.com.


[go-nuts] Re: setuid root

2021-09-20 Thread Rich
Yes. I tried running an exec: cmd=exec.Command("whoami") and it came as my 
user id not root.  But to set the permissions I'd run: 'chmod 4755 
myapplication'

On Monday, September 20, 2021 at 11:20:39 AM UTC-4 Tamás Gulácsi wrote:

> You mean "chown root app; chmod 4755 app" ?
>
> Rich a következőt írta (2021. szeptember 20., hétfő, 16:57:38 UTC+2):
>
>> I am trying to create a go program so that I can peform an action that is 
>> more complex than the example I have below. I can't give sudo right so run 
>> the application due to some policy we have at work that certain groups can 
>> only have read permissions. The company also have a policy that states any 
>> new directory / file is set with restrictive permissions. What I wanted to 
>> do is create a program that runs as root. (Like ping runs as root) but it 
>> doesn't seem to work.
>>
>> package main
>>
>> import (
>> "fmt"
>> "os"
>> "os/exec"
>> )
>>
>> func main() {
>>   cmd:=exec.Command("chmod","770", "/opt/app/mnt/mydirectory")
>>   cmd.Stdout = os.Stdout
>>   cmd.Stderr = os.Stderr
>>   err:=cmd.Run()
>>   if err != nil {
>> fmt.Println("ERROR:", err)
>>   }
>> }
>>
>> When I compile, then do a chmod 4755, and run it. I get a permissions 
>> denied. Looking for why this would be?
>>
>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/f381480a-0c62-46d4-b739-de7c07d182ffn%40googlegroups.com.


[go-nuts] setuid root

2021-09-20 Thread Rich
I am trying to create a go program so that I can peform an action that is 
more complex than the example I have below. I can't give sudo right so run 
the application due to some policy we have at work that certain groups can 
only have read permissions. The company also have a policy that states any 
new directory / file is set with restrictive permissions. What I wanted to 
do is create a program that runs as root. (Like ping runs as root) but it 
doesn't seem to work.

package main

import (
"fmt"
"os"
"os/exec"
)

func main() {
  cmd:=exec.Command("chmod","770", "/opt/app/mnt/mydirectory")
  cmd.Stdout = os.Stdout
  cmd.Stderr = os.Stderr
  err:=cmd.Run()
  if err != nil {
fmt.Println("ERROR:", err)
  }
}

When I compile, then do a chmod 4755, and run it. I get a permissions 
denied. Looking for why this would be?

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/b1986275-0129-40d7-88c1-a71419834341n%40googlegroups.com.


[go-nuts] Go Doc Tip and Request

2021-08-04 Thread Rich
I've been dabbling in Go since 2009 -- I grew accustomed to godoc.com, and 
the way godoc formats the documentation. Not that the new pkg.go.dev isn't 
any good -- its a matter of preference because you're used to seeing it one 
way, and pkg.go.dev displays it another. I am not a full time developer, 
and therefore in the hour or so I actually get to write code per day -- 
well I just have not found the time to get to know pkg.go.dev.

My solution is to run my own godoc server on my Mac.  First fire it 
up, godoc -http=localhost:6060 -play.  Then go in to Microsoft Edge, and go 
to http://localhost:6060. Click on the 'packages' button.  Once you've done 
this you can stop the godoc server. Next click on the three dots on the far 
upper right of 'Edge'. Select 'Apps'-->'Install This Site As An App'.  I 
called it 'GoDoc'. 

Open Terminal, go to ~/Applications/Edge\ 
Apps.localized/GoDoc.app/Contents/MacOS.  Move app_mode_loader to 
appGoDoc.  Edit a file in this directory called app_mode_loader.  Put the 
following in that file:
```
#!/bin/bash

nohup /Users/youruser/go/bin/godoc -http=localhost:6060 -play &
/Users/youruser/Applications/Edge\ 
Apps.localized/GoDoc.app/Contents/MacOS/appGoDoc
```

The first line starts the godoc server and listens on port 6060. The second 
line launches Microsoft Edge in App mode for your page.  If you close the 
window -- godoc still runs in the background, I've not found this to be a 
problem. On the first start you do have to give it a second or two as the 
page loads faster than godoc can start to serve. Just refresh. 

The request I have is that if at some point Go Doc takes on a new look like 
pkg.go.dev, consider that some may like the older format, maybe have godoc 
and godoc-old or something like that. 

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/7ef6d703-801e-46e0-a698-0969922cc7c7n%40googlegroups.com.


Re: [go-nuts] Go 1.16 and modules

2021-03-29 Thread Rich
I really WANT to use go modules on all my projects, but there are times I 
just want to write a quick piece of code that I can 'go run'. Its usually 
just 20 lines, just used to test something out like a rest call to an 
internal server (can't do that on go playground) and for me go modules just 
makes it more complex. So what I do is what Reto stated above, set an 
environment variable for GO111MODULE=OFF.  Now at the command line I can 
write a quick code sample and just type 'go run sample.go' and it runs.  
For my projects where I want go modules I use a Make file:

GO111MODULE=on GOOS=linux GOARCH=amd64 go build $(compilerFlag) -o 
mygoproject mygoproject.go othergofiles.go...

   

On Monday, March 29, 2021 at 12:33:57 AM UTC-4 amits...@gmail.com wrote:

> On Mon, Mar 29, 2021 at 12:15 PM Reto  wrote:
> >
> > On Mon, Mar 29, 2021 at 11:18:28AM +1100, Amit Saha wrote:
> > > "Module-aware mode is enabled by default, regardless of whether a
> > > go.mod file is present in the current working directory or a parent
> > > directory. More precisely, the GO111MODULE environment variable now
> > > defaults to on. To switch to the previous behavior, set GO111MODULE to
> > > auto. "
> > > Is that implying the above behavior?
> >
> > Yes: https://golang.org/ref/mod#mod-commands
> >
> > Note that you can still run the hello world programs via `go run` without
> > having a module.
>
> Thanks.
>
> >
> > --
> > 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...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/20210329011453.3dddpz3syc6wv636%40feather.localdomain
> .
>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/c62dd3f2-da7f-494a-8bdc-f7c7f1c4b308n%40googlegroups.com.


[go-nuts] go mod to private repository using ssh

2021-02-18 Thread Rich
I've been avoiding the move to using go mod. Mainly because every time I 
try it chokes on any of the internal repositories i have setup using 
ssh://g...@mycoderepo.com:7900.  I put in to my ~/.gitconfig:

[url "ssh://g...@mycoderepo.com:7900"]
insteadOf = https://mycoderepo.com/src

So now if I use git, and run:

git clone https://mycoderepo.com/src/companyorg/gofunctions.git

It will then replace the https://mycoderepo.com/src/ with 
ssh://g...@mycoderepo.com:7900 and the clone works. Same with pull, fetch.

When I setup go modules, and then try to build a project that uses the 
gofunctions repository: import "mycoderepo.com/src/companyorg/gofunctions"

I get this:
go: finding module for package mycoderepo.com/companyorg/gofunctions
go: downloading mycoderepo.com/companyorg/gofunctions 
v0.0.0-20180913124604-19aec48c9978
format.go:10:2: 
mycoderepo.com/companyorg/gofunctions@v0.0.0-20180913124604-19aec48c9978: 
verifying module: 
mycoderepo.com/companyorg/gofunctions@v0.0.0-20180913124604-19aec48c9978: 
reading 
https://sum.golang.org/lookup/mycoderepo.com/companyorg/gofunctions@v0.0.0-20180913124604-19aec48c9978:
 
410 Gone
server response: not found: 
mycoderepo.com/companyorg/gofunctions@v0.0.0-20180913124604-19aec48c9978: 
unrecognized import path "mycoderepo.com/companyorg/gofunctions": https 
fetch: Get "https://mycoderepo.com/companyorg/gofunctions?go-get=1": dial 
tcp: lookup mycoderepo.com on 8.8.8.8:53: no such host
make: *** [mac] Error 1:

Which brings up many questions. 1. Why is it using https when I told git to 
substitute that with ssh?  WHy is it going to GOOGLE'S DNS to resolve a 
company address that is internal and not using my system's DNS setup?

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/46e90705-cd6b-40d4-9e0f-8104d44880bdn%40googlegroups.com.


Re: [go-nuts] net/http TLS issue

2020-10-19 Thread Rich
Thanks for your reply. I think I have it down now. What I am going to do 
is: 
1. Read the key in to pemBlk
2. See if it's got a passcode
3. If it does decrypt
```
if x509.IsEncryptedPEMBlock(pemBlk) {
keyPEMBlock, err = x509.DecryptPEMBlock(pemBlk, []byte(passphrase))
```

As to having to have a human enter the passcode on each restart. I have a 
json configuration file that contains directives for where the keypair is 
an the passphrase. Read the passcode, try to decrypt it.  If the decrypt 
fails -- its probably in clear text so encrypt it and write it back to the 
config file. This way all the person has to do is put the passphrase in 
clear text, restart application, password is now encrypted in the config 
file. When the password changes because the key changed (once a year), 
change the config (plaintext) and restart -- passphrase is then encrypted. 
 
On Sunday, October 18, 2020 at 9:01:23 PM UTC-4 pat2...@gmail.com wrote:

> On Sunday, October 18, 2020 at 4:39:46 PM UTC-4 Rich wrote:
>
>> I have no problem writing this myself and I already have ideas on what I 
>> am going to do, but before I do that I thought I'd ask and see if anyone 
>> knew of a package, or some easier way that did this already. I've spent 
>> hours in the past writing code only to find later someone has written a 
>> great package that does what I need and more. Never hurts to ask right ;
>>
>
> The great packages have been written. But the real solution is to use a 
> service either in software like AWS Secrets Manager or in a hardware box 
> like the banking networks like.  If your company has had this policy a long 
> time, use whatever other systems have used. 
>
> Writing crypto software that seems to work is not hard. For this case, 
> have the operator enter a passphrase, run it thru a HMAC, and then use AES 
> 256 to encipher/decipher the CERT. Store the binary in some standard 
> format, try to avoid ANS.1 if you can possibly do it.
>
> Writing crypto software that really works, is secure, etc. is very hard. 
> No offense, but you are unlikely to do it.
>
> I don't understand how this is supposed to work. Do you ask the system's 
> operator to type in the passphrase every time the service is restarted? 
> Most modern systems don't have a human operator to do such typing. And how 
> do you ensure that there is no keyboard logger on the operator's terminal? 
> Or are you keeping the passphrase in someplace like an environment variable 
> or a secret file?
>
> The software and the crypto are only a tiny part of the issue. Either do 
> whatever made them happy in the past, or find out what is really driving 
> this "requirement".
>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/a6279a0d-63e6-4c2d-8047-cd7c7905956dn%40googlegroups.com.


Re: [go-nuts] net/http TLS issue

2020-10-18 Thread Rich
Thanks for your reply, however as I stated it's company policy to have a 
passphrase, even our java. keystores have a passcode. Using other services 
or methods, or just not having a passcode -- Just not the way they want it 
done. I am not a part of the security team that makes this stuff up and you 
might as well try to get water to flow up hill to change policies. It is 
what it is, I gotta deal with it. 

I have no problem writing this myself and I already have ideas on what I am 
going to do, but before I do that I thought I'd ask and see if anyone knew 
of a package, or some easier way that did this already. I've spent hours in 
the past writing code only to find later someone has written a great 
package that does what I need and more. Never hurts to ask right ;)


On Friday, October 16, 2020 at 6:33:14 PM UTC-4 mar...@gmail.com wrote:

> Having a passcode to protect a key file for a production service is 
> pointless, because you move the problem of storing the certificate securely 
> to the problem of storing the passcode securely, so might as well skip the 
> passcode and store the cert securely.
>
> Your certificate is probably encoded as a PEM cert, so you'd have to 
> manually call https://golang.org/pkg/crypto/x509/#DecryptPEMBlock and 
> provide a password, then construct your listener yourself using the 
> unmarshaled certificate. So, how are you going to protect this passcode? Is 
> someone going to have to provide it every time you start?
>
> Generally, in production systems, we use some kind of secret manager to 
> store that certificate, such as AWS Secrets Manager or encrypt it with KMS, 
> store it in Vault, etc. Ideally, you actually make a subordinate cert for 
> that service and rotate it at a reasonable interval.
>
> On Fri, Oct 16, 2020 at 2:06 PM Rich  wrote:
>
>> I don't know if we're the only company on the planet that demands the 
>> https keys have a passcode to them but I've been having a heck of a time 
>> trying to find a good way to serve https using a key with a passphrase.  
>>
>> err := ListenAndServeTLS(addr, certFile, keyFile string 
>> <https://godoc.org/builtin#string>, handler Handler 
>> <https://godoc.org/net/http#Handler>)  
>>
>> If they keyFile has a passcode this doesn't work and the examples I've 
>> seen take this one line and turn it into a much longer chunk of code.
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/c75fc8f6-abe4-4614-8281-cef4cb315ac3n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/c75fc8f6-abe4-4614-8281-cef4cb315ac3n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/732f64f7-d4ae-49f3-be69-58a816005097n%40googlegroups.com.


[go-nuts] net/http TLS issue

2020-10-16 Thread Rich
I don't know if we're the only company on the planet that demands the https 
keys have a passcode to them but I've been having a heck of a time trying 
to find a good way to serve https using a key with a passphrase.  

err := ListenAndServeTLS(addr, certFile, keyFile string 
, handler Handler 
)  

If they keyFile has a passcode this doesn't work and the examples I've seen 
take this one line and turn it into a much longer chunk of code.

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/c75fc8f6-abe4-4614-8281-cef4cb315ac3n%40googlegroups.com.


[go-nuts] SQL Do I use Query or Exec?

2020-09-15 Thread Rich


I am writing a program in Go that allows users to put a query to a 
database. This program uses multiple different drivers such as Postgres, 
MySQL, and I want to be able to add other drivers as needed. This is 
supposed to be something a user can use and depending on how the 
configuration file is setup, connect to the server using the driver for 
that server, as well as the configured username / password. I've integrated 
it in to use my company's authentication system so that it can checks the 
user's rights on the server to make sure that user has the authority to run 
the commands specified. So a user can type ANY query they want -- select 
update insert etc

sqlrun -h mysqlsrv -e "select..."

 sqlrun -h postgressrv -e "update ..."

-h Specifies the host and in a config file the host is configured with the 
driver, default database, username, and an encrypted password, I've 
integrated it in to my company's authentication system to know if the user 
can execute queries at all, or read only, or can write to the database. 

So right now I pass all user given queries to sql.Query(). This works but 
when the user is doing an update or insert -- I can't output the number of 
rows impacted, for that I would need to use sql.Exec()

What I want to know is if there is a way to get Rows impacted with a query, 
or if there is a more comprehensive way to evaluate the query to know if I 
should query or exec? I've looked into doing simple things like look at the 
first word, if it's select, run query, if it's update or insert run exec. 
The problem with that is the complexity of sql, you can have a select 
statement that doesn't start with the word select... For example: "WITH 
temporary_name AS (SELECT * FROM table_name)..."  I am sure there could be 
others where Insert or Update are not always the first word of the query... 

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/530c3310-c997-4620-abe1-9e6f570d8666n%40googlegroups.com.


[go-nuts] generics go2go Type List in Interface - Struct Type

2020-08-11 Thread Rich Moyse

Attempting to use a Type List in an Interface 

 
to restrict the types allowed to instantiate a generic function (example in 
go2go ).  The Type List within 
the Constraint Interface (Santa) contains only one struct type 
 (SantaSad).  This struct type 
and a second, independent struct type (SantaHappy) both implement the 
Constraint Interface (Santa) specified as a type parameter for the generic 
function.  Given this situation, I expected the instantiation of the 
generic function with a type argument of the type (SantaSad), that appears 
in the Constraint's Interface Type List to succeed, which it does, and 
instantiating the generic function with the struct type, absent from the 
Type List (SantaHappy), to fail.  However, instead of failing, this second 
case succeeds.  Is this the intended behavior?


-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/44b6cb78-d143-437f-b4e0-f1cf8d642989n%40googlegroups.com.


[go-nuts] Re: TCPScan -- Check TCP Connectivity

2020-01-28 Thread Rich
I didn't leave the URL to github:

https://github.com/rmasci/tcpscan

Sorry about that.



On Tuesday, January 28, 2020 at 10:23:17 AM UTC-5, Rich wrote:
>
> This  originally started as a learning exercise in Go Routines when going 
> through a course on Go Programming. I needed a real world programming 
> example, and every day it seems I have to perform checks for 
> tcpconnectivity -- and worse yet our security guys didn't like putting on 
> netcat or nmap so we had to use telnet.  That's like using a screwdriver as 
> a chisel, it works but not what it was designed for. We literally had 
> people who made scripts using telnet to check the connectivity to 100 hosts 
> to see if they were online on a regular basis, which using Telnet took over 
> a minute for all of them to time out and report if they were open, but 
> didn't tell you if the port was open, closed or filtered by a firewall. 
>
> So I took my little learning excersize and made a program called tcpscan. 
> Honestly I am more of a sysadmin than I am a programmer, and Go is really 
> my first C like compiled language, and I relied more on Bash, PHP, little 
> Perl, TCL (Expect) so I am sure there are a lot of things that could be 
> done better in the program -- but thats what I am hoping for. If this is 
> useful, people like it, make it better right?
>
> Small Example of scanning hosts from a file, Checking TCP, Checking ICMP 
> (Ping) and SSL Cert
>
> ~] $ cat list;tcpscan -f list -i -s
> https://www.youtube.com
> https://www.google.com
> https://www.twitter.com
> https://www.github.com
> https://www.amazon.com
>
> ++-+---+-+-++
> |Address |Port |Status | TCP |ICMP |  
>   SSL |
>
> ++=+===+=+=++
> |www.youtube.com | 443 |  Open | 91.88ms | 92.87ms |  
>TLS v1.2 / OK: 63 days |
> | www.google.com | 443 |  Open | 62.23ms | 63.89ms |  
>TLS v1.2 / OK: 63 days |
> |www.twitter.com | 443 |  Open |101.69ms | 90.86ms |  
>TLS v1.2 / OK: 38 days |
> | www.github.com | 443 |  Open |122.60ms |121.52ms |  
>   TLS v1.2 / OK: 126 days |
> | www.amazon.com | 443 |  Open |128.97ms | 76.66ms |  
>   TLS v1.2 / OK: 337 days |
>
> ++-+---+-+-++
>
> Scanned 5 hosts/ports in 493.79ms
>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/9a775f36-8419-4061-a97b-0a659cf7c412%40googlegroups.com.


Re: [go-nuts] JSON: Having trouble parsing map keys with dots like {"foo.bar":"baz"}

2020-01-28 Thread Rich
All of these are good suggestions -- but when working with JSON I find this 
package to be very helpful: 

https://github.com/hjson/hjson-go  

I use json as a config file for my programs and when users fat finger the 
config, forget a comma or put a space in the wrong place -- this for the 
most part fixes those minor blunders.  I've also found that even though 
another system generated the JSON, it might not be fully compliant with 
what I wrote, hjson-go has bailed me out on more than one project. 



On Tuesday, January 28, 2020 at 9:59:51 AM UTC-5, Jake Montgomery wrote:
>
> FYI - "go vet" will catch this. Running "go vet" is always a good idea.
>
> On Tuesday, January 28, 2020 at 9:00:05 AM UTC-5, Lutz Horn wrote:
>>
>> Remove the blank in ``json: "baz.bar"` and make it `json:"baz.bar"`. This 
>> works: https://play.golang.com/p/i9SURYgGO66 
>>
>>  
>> Von: golan...@googlegroups.com  im Auftrag 
>> von ma...@markhansen.co.nz  
>> Gesendet: Dienstag, 28. Januar 2020 12:14 
>> An: golang-nuts 
>> Betreff: [go-nuts] JSON: Having trouble parsing map keys with dots like 
>> {"foo.bar":"baz"} 
>>
>> Hi folks, for background, I'm trying to read the Kaiterra API<
>> https://www.kaiterra.com/dev/#overview> using encoding/json, which has 
>> JSON values like this: 
>>
>> {"id":"-0001-0001--7e57c0de","info.aqi":{"ts":"2018-03-26T08:53:20Z","data":{"pm10":120,"pm25":214}}}
>>  
>>
>>
>> I'm having trouble parsing the "info.aqi" field using encoding/json. I 
>> set the "info.aqi" field as a struct tag `json: "info.aqi"`, but the struct 
>> is just empty after parsing. 
>>
>> It seems more likely I'm holding it wrong, but I'm wondering if perhaps 
>> this is a bug in Go's JSON parsing? 
>>
>> I thought I'd make a minimal repro test, which fails: 
>>
>> package main 
>>
>> import ( 
>> "encoding/json" 
>> "strings" 
>> "testing" 
>> ) 
>>
>> type Foo struct { 
>> BazBar string `json: "baz.bar"` 
>> Quxstring `json: "qux"` 
>> } 
>>
>> func TestDotKeyJsonParsing(t *testing.T) { 
>> f := {} 
>> d := json.NewDecoder(strings.NewReader(`{"baz.bar": "hello", "qux": 
>> "hi"}`)) 
>> err := d.Decode(f) 
>> if err != nil { 
>> t.Fatalf("json decoding failed: %v", err) 
>> } 
>> if f.Qux != "hi" { 
>> t.Fatalf("Expected f.Qux to be hi") 
>> } 
>>
>> if f.BazBar != "hello" { 
>> t.Errorf("wanted: hello, got: %q", f.BazBar) 
>> } 
>> } 
>>
>> And the Qux field passes fine, but the BazBar field is not set, so the 
>> test fails there: 
>> --- FAIL: TestDotKeyJsonParsing (0.00s) 
>> /Users/mark/projects/godot/dot_test.go:26: wanted: hello, got: "" 
>>
>>
>>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/36e6c19c-77e2-40cc-91b4-d155085564c1%40googlegroups.com.


[go-nuts] TCPScan -- Check TCP Connectivity

2020-01-28 Thread Rich
This  originally started as a learning exercise in Go Routines when going 
through a course on Go Programming. I needed a real world programming 
example, and every day it seems I have to perform checks for 
tcpconnectivity -- and worse yet our security guys didn't like putting on 
netcat or nmap so we had to use telnet.  That's like using a screwdriver as 
a chisel, it works but not what it was designed for. We literally had 
people who made scripts using telnet to check the connectivity to 100 hosts 
to see if they were online on a regular basis, which using Telnet took over 
a minute for all of them to time out and report if they were open, but 
didn't tell you if the port was open, closed or filtered by a firewall. 

So I took my little learning excersize and made a program called tcpscan. 
Honestly I am more of a sysadmin than I am a programmer, and Go is really 
my first C like compiled language, and I relied more on Bash, PHP, little 
Perl, TCL (Expect) so I am sure there are a lot of things that could be 
done better in the program -- but thats what I am hoping for. If this is 
useful, people like it, make it better right?

Small Example of scanning hosts from a file, Checking TCP, Checking ICMP 
(Ping) and SSL Cert

~] $ cat list;tcpscan -f list -i -s
https://www.youtube.com
https://www.google.com
https://www.twitter.com
https://www.github.com
https://www.amazon.com
++-+---+-+-++
|Address |Port |Status | TCP |ICMP |
SSL |
++=+===+=+=++
|www.youtube.com | 443 |  Open | 91.88ms | 92.87ms |
 TLS v1.2 / OK: 63 days |
| www.google.com | 443 |  Open | 62.23ms | 63.89ms |
 TLS v1.2 / OK: 63 days |
|www.twitter.com | 443 |  Open |101.69ms | 90.86ms |
 TLS v1.2 / OK: 38 days |
| www.github.com | 443 |  Open |122.60ms |121.52ms |
TLS v1.2 / OK: 126 days |
| www.amazon.com | 443 |  Open |128.97ms | 76.66ms |
TLS v1.2 / OK: 337 days |
++-+---+-+-++

Scanned 5 hosts/ports in 493.79ms

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/49924f7f-da71-452f-89af-c8ee3edc42ce%40googlegroups.com.


[go-nuts] Scanning TCP Hosts using TCPSCAN

2020-01-28 Thread Rich
This  originally started as a learning exercise in Go Routines when going 
through a course on Go Programming. I needed a real world programming 
example, and every day it seems I have to perform checks for 
tcpconnectivity -- and worse yet our security guys didn't like putting on 
netcat or nmap so we had to use telnet.  That's like using a screwdriver as 
a chisel, it works but not what it was designed for. We literally had 
people who made scripts using telnet to check the connectivity to 100 hosts 
to see if they were online on a regular basis, which using Telnet took over 
a minute for all of them to time out and report if they were open, but 
didn't tell you if the port was open, closed or filtered by a firewall. 

So I took my little learning excersize and made a program called tcpscan. 
Honestly I am more of a sysadmin than I am a programmer, and Go is really 
my first C like compiled language, and I relied more on Bash, PHP, little 
Perl, TCL (Expect) so I am sure there are a lot of things that could be 
done better in the program -- but thats what I am hoping for. If this is 
useful, people like it, make it better right?

http://github.com/rmasci/tcpscan

 ~] $ cat list;tcpscan -f list
https://www.youtube.com
https://www.google.com
https://www.twitter.com
https://www.github.com
https://www.amazon.com
++-+---+-+
|Address |Port |Status | TCP |
++=+===+=+
|www.youtube.com | 443 |  Open | 45.51ms |
| www.google.com | 443 |  Open | 44.95ms |
|www.twitter.com | 443 |  Open | 61.89ms |
| www.github.com | 443 |  Open | 77.86ms |
| www.amazon.com | 443 |  Open |153.61ms |
++-+---+-+

Scanned 5 hosts/ports in 170.48ms

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/fc2d591f-a7cf-4f65-aade-224bb02fb128%40googlegroups.com.


[go-nuts] Help get me started on a project

2019-12-17 Thread Rich
I need to write a program that runs an external program and the user needs 
to interact with that external program.  So I know I can do something like 
this:


func main() {
cmd := exec.Command("/usr/local/bin/interactiveApp")
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Run()

What I need to be able to do is look at what the user is typing as the user 
can make some errors that would be unfortunate, So what I want to do is 
look at what the user typed and tell them that isn't possible. If the 
command is good send it.

User: "self destruct in 10 minutes"
MyApp: "sorry you can't do that."

This is very similar to what you can do with Don Libes's Expect interact 
statement which works like a switch statement, if a match is found, it runs 
that instead of what the user typed. 

spawn "/usr/local/bin/interactiveApp"
...stuff...

interact {
"self destruct" {
send_user "Sorry you can't run that"
send "start over"
}
}
 
So if the user types "self destruct" the program will send a message to the 
user, and then send 'start over' to the interactiveApp.I've looked 
around and I've not seen anything that can reliably read from what the user 
types in, evaluate it,  and pass it to the program that is launched by exec.

I didn't write the app we're  running, and the guy that wrote it is not 
able to support it any longer. I"d write it in expect but expect uses TCL 
which is very very slow, and there are other aspects to Go that I really 
need in other areas of the program.

Thanks! 

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/65aab0d3-0d74-425e-a4fe-c26c39b98169%40googlegroups.com.


[go-nuts] Show rows affected from query

2019-10-03 Thread Rich
I've written a program that allows users to put in MySQL queries and get 
results from it. Those queries can be selects, inserts, update, delete etc. 
I would a better sample of the code but currently the code is over 1000+ 
lines, but I do something like this:

db,err :=sql.Open(mysql, loginCreds)
rows, err db.Query("")

This works, and you can do selects, inserts, deletes, drop -- basically any 
query you can run with the mysql client will work, but what you're missing 
is when it doesn't have any rows to display is the rows affected (such as 
an insert or update).  I have nothing to return to the user other than the 
query worked.  So the user has no idea if 1 or 1 rows were updated or 
deleted from the query.  For this I'd have to be using db.Exec which 
returns an sql.Result, where I can pull the rows affected. Is there a way 
to get rows affected from a query? I don't want to have a decision tree to 
figure out based on the query given to use sql.Exec or sql.Query.  I am not 
that good of a DBA to be able to figure that out. :)

Thanks,

Rich

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/cdddfce5-0fd8-4776-844b-1f5cd5ef33b0%40googlegroups.com.


Re: [go-nuts] JSON Marshal for config file url encoding string.

2019-08-12 Thread Rich
Thanks!! Totally missed that one. Switched to from json.Marshal to 
json.Encode:
jsonEnc:=json.NewEncoder(file)
jsonEnc.SetIndent("", tab)
jsonEnc.SetEscapeHTML(false) 

Works great!!


On Monday, August 12, 2019 at 2:18:02 PM UTC-4, Jesper Louis Andersen wrote:
>
> Documented here: https://golang.org/pkg/encoding/json/#Marshal
>
> There is also a description of how to avoid it.
>
> On Mon, Aug 12, 2019 at 7:39 PM Rich > 
> wrote:
>
>> Hi I have an application that I wrote that uses JSON for the config file. 
>> The application is a chatbot I use internally and allows users to run linux 
>> commands to get information both locally and via ssh. The chatbot interface 
>> uses basic html to render the output so 90% of the time I want to have the 
>> output be surrounded by "" and "". But not every one running the 
>> application may want this, their chatbot may run a commands that that uses 
>> other HTML formatting. So I created a directive in the config file allowing 
>> the user to configure this:
>>
>> "HTMLFormat": {
>> "Start": "",
>> "Finish": ""
>> }
>>
>> The problem is that this config file also contains a password -- so I 
>> allow the user to put in clear text the password, and on restart the 
>> password gets encrypted, and then I do a simple json.Marshal and rewrite 
>> the config with the encrypted password:
>>
>> file, err := json.MarshalIndent(config, "", "   ")
>> errorHandle(err, "Json Marshal", false)
>> err = ioutil.WriteFile(cFile, file, 0644)
>> errorHandle(err, "Write Config", false)
>>
>> In the above, 'config' is the struct that contains all the directive, 
>> 'cFile' is the config file being written.  When the file gets written it 
>> looks like this:
>>  has toIn the json there is a directive for the application to add html 
>> formatting to the start of its output.
>>
>> "HTMLFormat": {
>> "Start": "\u003cpre\u003e",
>> "Finish": "\u003e\/pre\u003e"
>> }
>>
>> Any idea why it's doing this?
>>
>> -- 
>> 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 golan...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/8a7a344a-55aa-468a-8346-c1db036d8372%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/8a7a344a-55aa-468a-8346-c1db036d8372%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
>
> -- 
> J.
>

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/e269493e-e665-4dee-b7a2-63464c3fd1e1%40googlegroups.com.


[go-nuts] JSON Marshal for config file url encoding string.

2019-08-12 Thread Rich
Hi I have an application that I wrote that uses JSON for the config file. 
The application is a chatbot I use internally and allows users to run linux 
commands to get information both locally and via ssh. The chatbot interface 
uses basic html to render the output so 90% of the time I want to have the 
output be surrounded by "" and "". But not every one running the 
application may want this, their chatbot may run a commands that that uses 
other HTML formatting. So I created a directive in the config file allowing 
the user to configure this:

"HTMLFormat": {
"Start": "",
"Finish": ""
}

The problem is that this config file also contains a password -- so I allow 
the user to put in clear text the password, and on restart the password 
gets encrypted, and then I do a simple json.Marshal and rewrite the config 
with the encrypted password:

file, err := json.MarshalIndent(config, "", "   ")
errorHandle(err, "Json Marshal", false)
err = ioutil.WriteFile(cFile, file, 0644)
errorHandle(err, "Write Config", false)

In the above, 'config' is the struct that contains all the directive, 
'cFile' is the config file being written.  When the file gets written it 
looks like this:
 has toIn the json there is a directive for the application to add html 
formatting to the start of its output.

"HTMLFormat": {
"Start": "\u003cpre\u003e",
"Finish": "\u003e\/pre\u003e"
}

Any idea why it's doing this?

-- 
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 the web visit 
https://groups.google.com/d/msgid/golang-nuts/8a7a344a-55aa-468a-8346-c1db036d8372%40googlegroups.com.


Re: [go-nuts] Println output missing in Windows, but not Linux

2019-03-15 Thread Rich Podraza
Thanks, it did seem to be something like that. In the cmd window I couldn't
see it, but when I wrote to a file I could see garbage bytes at the end of
my line

On Tue, Mar 12, 2019 at 10:34 PM Kurtis Rader  wrote:

> I'm a new Go programmer but a grey beard (I started programming in the
> 1970's). I'm just spit-balling but the behavior you describe suggest to me
> a locale problem. For example, the Go program is likely emitting UTF-8 but
> your MS Windows console is likely expecting a different encoding (e.g.,
> code page ). See
> https://stackoverflow.com/questions/12053168/how-to-properly-output-a-string-in-a-windows-console-with-go
> as one of many results I get when I search for "go println windows". See
> also https://en.wikipedia.org/wiki/Windows_code_page.
>
> On Tue, Mar 12, 2019 at 7:20 PM rick  wrote:
>
>> I ran this same program:
>> https://www.thepolyglotdeveloper.com/2017/05/network-sockets-with-the-go-programming-language/
>> :
>>
>> in Linux, and the output was exactly as expected. But on Windows, I was
>> seeing unexpected results. Sometimes just a newline printed. Sometimes the
>> entire buffer printed, but it was all whitespace. But it worked fine on
>> Linux. Any ideas? At first I thought it was related to the concurrency, but
>> the app never ended or broke connections unexpectedly, but then it worked
>> fine on Linux
>>
>> --
>> 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://groups.google.com/d/optout.
>>
>
>
> --
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
>

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Visual Studio Code oddity with Go

2019-03-03 Thread Rich
That is exactly what I did to fix it. -- Thanks!

On Sunday, March 3, 2019 at 9:42:38 AM UTC-5, Louki Sumirniy wrote:
>
> That is a strange setting for GOBIN... Isn't that the folder `go install` 
> puts binaries? I always set it to ~/bin and  put that also in my path. I 
> like to use `go install` instead of `go build` because then I don't have to 
> remember not to let it slip through into a commit.
>
> On Sunday, 3 March 2019 15:29:28 UTC+1, Rich wrote:
>>
>> Thank you!! This worked for me. $GOPATH is set to ~/go, but when it was 
>> installing gocode it installed to /usr/local/go/bin instead of ~/go/bin -- 
>> this is because the $GOBIN variable is set to /usr/local/go/bin. 
>>
>> On Saturday, February 23, 2019 at 3:05:58 PM UTC-5, Joseph Pratt wrote:
>>>
>>> Rich, you should check where your GOPATH is pointing. My guess is that 
>>> VSCode is successfully installing the tool, but it's installing it in the 
>>> "wrong" place. I have my $GOPATH is set to "\go" and my project 
>>> folder structure is "$GOPATH\src\myDomain.com\myProject\main.go" and when I 
>>> run VSCode I open the top-level $GOPATH folder. That way, I see all the 
>>> tools that the VSCode Go Extension recommends to installation go in the 
>>> "$GOPATH\go\src\github.com\.." and the "$GOPATH\go\golang.org.." in the 
>>> folder explorer side-bar (screenshot attached). Hope that helps!
>>>
>>> On Friday, February 22, 2019 at 12:03:59 AM UTC-5, Rich wrote:
>>>>
>>>> Yeah. When I install the tool, it always gives me a success.  When I 
>>>> selected all of them it also gave me a success.
>>>>
>>>> Thanks!
>>>>
>>>> On Thursday, February 21, 2019 at 10:42:33 PM UTC-5, andrey mirtchovski 
>>>> wrote:
>>>>>
>>>>> > I tried the solution posted by Andrey (Thank you!) and it still does 
>>>>> the popup thing.  Oh well, it's a minor distraction, click update and it 
>>>>> goes away. 
>>>>>
>>>>> If you go to the OUTPUT tab does it give you an error message? or does 
>>>>> it say "things successfully installed"? 
>>>>>
>>>>

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Visual Studio Code oddity with Go

2019-03-03 Thread Rich
Thank you!! This worked for me. $GOPATH is set to ~/go, but when it was 
installing gocode it installed to /usr/local/go/bin instead of ~/go/bin -- 
this is because the $GOBIN variable is set to /usr/local/go/bin. 

On Saturday, February 23, 2019 at 3:05:58 PM UTC-5, Joseph Pratt wrote:
>
> Rich, you should check where your GOPATH is pointing. My guess is that 
> VSCode is successfully installing the tool, but it's installing it in the 
> "wrong" place. I have my $GOPATH is set to "\go" and my project 
> folder structure is "$GOPATH\src\myDomain.com\myProject\main.go" and when I 
> run VSCode I open the top-level $GOPATH folder. That way, I see all the 
> tools that the VSCode Go Extension recommends to installation go in the 
> "$GOPATH\go\src\github.com\.." and the "$GOPATH\go\golang.org.." in the 
> folder explorer side-bar (screenshot attached). Hope that helps!
>
> On Friday, February 22, 2019 at 12:03:59 AM UTC-5, Rich wrote:
>>
>> Yeah. When I install the tool, it always gives me a success.  When I 
>> selected all of them it also gave me a success.
>>
>> Thanks!
>>
>> On Thursday, February 21, 2019 at 10:42:33 PM UTC-5, andrey mirtchovski 
>> wrote:
>>>
>>> > I tried the solution posted by Andrey (Thank you!) and it still does 
>>> the popup thing.  Oh well, it's a minor distraction, click update and it 
>>> goes away. 
>>>
>>> If you go to the OUTPUT tab does it give you an error message? or does 
>>> it say "things successfully installed"? 
>>>
>>

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Visual Studio Code oddity with Go

2019-02-21 Thread Rich
Yeah. When I install the tool, it always gives me a success.  When I 
selected all of them it also gave me a success.

Thanks!

On Thursday, February 21, 2019 at 10:42:33 PM UTC-5, andrey mirtchovski 
wrote:
>
> > I tried the solution posted by Andrey (Thank you!) and it still does the 
> popup thing.  Oh well, it's a minor distraction, click update and it goes 
> away. 
>
> If you go to the OUTPUT tab does it give you an error message? or does 
> it say "things successfully installed"? 
>

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Visual Studio Code oddity with Go

2019-02-21 Thread Rich
Just about every video on Go, I see people using VSC, and so was hoping to 
find another Go user that has this problem, that's why I posted it here 
rather than the VSC Github site. I'm on a mac, reinstalled, deleted my 
settings -- all the usual stuff but it keeps popping up a message to 
install gocode tools.

I tried the solution posted by Andrey (Thank you!) and it still does the 
popup thing.  Oh well, it's a minor distraction, click update and it goes 
away.


On Thursday, February 21, 2019 at 9:14:12 PM UTC-5, andrey mirtchovski 
wrote:
>
> reposting my private comment from a day ago for those searching for 
> answers: 
>
> try "command-shift-p" or ctrl-shift-p depending on your operating 
> system, to bring the "all commands" pop-up. there you should be able 
> to find "Go: Install/Update tools". click on the checkboxes. hit 
> enter. 
>
> On Wed, Feb 20, 2019 at 7:14 AM Rich > 
> wrote: 
> > 
> > I tried googling this but I not been able to find a solution, hopefully 
> I can ask this here and someone else knows how to fix this.  I use Visual 
> Studio Code -- because it's free. The issue I am having is that every time 
> I use Visual Studio Code I get the popup that says: 
> > 
> >> The Go extension is better with the latest version of "gocode".  Use 
> "go get -u -v github.com/mdempsky/gocode" to update 
> > 
> > 
> > Anyone else have this or know how to fix this? It shouldn't ask EVERY 
> time I use Visual Studio Code? 
> > 
> > -- 
> > 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...@googlegroups.com . 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Visual Studio Code oddity with Go

2019-02-20 Thread Rich
I tried googling this but I not been able to find a solution, hopefully I 
can ask this here and someone else knows how to fix this.  I use Visual 
Studio Code -- because it's free. The issue I am having is that every time 
I use Visual Studio Code I get the popup that says: 

The Go extension is better with the latest version of "gocode".  Use "go 
> get -u -v github.com/mdempsky/gocode" to update


Anyone else have this or know how to fix this? It shouldn't ask EVERY time 
I use Visual Studio Code? 

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Re: Temporarily allow unused variables

2019-01-09 Thread Rich
Yes at times it's a pain, after programming for a while in Go you just get 
used to it, and I seldom run into an unused variable. Use Visual Studio 
Code, you'll get a red squiggly line and an error long before you ever try 
to compile the code. If you really want to keep the variable, variable=_ 
takes care of it. 

On Wednesday, January 9, 2019 at 5:01:52 PM UTC-5, Ian Lance Taylor wrote:
>
> On Wed, Jan 9, 2019 at 1:46 PM > wrote: 
> > 
> > So, 2019 year. Still no compiler flag. Slphers :) 
>
> This isn't a matter of being slow, it's an intentional decision. 
>
> Ian 
>

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Remove path from error messages

2018-10-16 Thread Rich
Hi and Thanks Peter for your reply!  I have compiled this on my mac, and am 
running it on a linux system.  I compile it like this:

GOOS=linux GOARCH=amd64 go build  -o binaries/linux64/mysqlrun mysqlrun.go

Then I copy that binary to the server I am running it on and if there is an 
error -- it spits out an error message containing the path and the line 
number.  I've notice this happens with any program. OK this is only an 
example to show the error message. If you've got a program:
package main

import (
"fmt"
"strconv"
)

func main() {
var divByS string
fmt.Println("What do you want to divide by?")
fmt.Printf("Number: ")
fmt.Scanln()
fmt.Println("Great, divide 100 by " + divByS)
divBy, err := strconv.Atoi(divByS)
if err != nil {
fmt.Printf("OOOpps %v\n", err)
}
x := 100 / divBy
fmt.Println(x)
}

yes I know it's easy to catch a divide by zero, but it's to show the 
error... When I run this:

What do you want to divide by?
Number: 0
Great, divide 100 by 0
panic: runtime error: integer divide by zero

goroutine 1 [running]:
main.main()
/Users/rich/go/test.go:18 +0x2cf

I don't want the highlighted part to print.

On Tuesday, October 16, 2018 at 2:35:17 PM UTC-4, Peter Bourgon wrote:
>
> Error messages don't include any contextual information by default. If 
> the path to a Go file is in there, it's because whatever created the 
> error message (or modified it at some point) put it there. Where is 
> that error created, and what touches it as it flows through the call 
> stack to the logging statement that prints it to the screen? Don't 
> forget to also check the logging package itself, which can sometimes 
> annotate with caller information. Trace that out, and you'll find your 
> answer. 
> On Tue, Oct 16, 2018 at 11:28 AM Rich > 
> wrote: 
> > 
> > I apologize if this has been asked before but I searched google and this 
> group and didn't find it.  How do you remove the path from the error 
> messages?  So I have a valid error: 
> > 
> > 2018/10/16 18:13:12 [error] in 
> main.checkMaster[/Users/rich/go/mysqlrun/mysqlrun.go:739] Error 1045: 
> Access denied for user 
> > 
> > How do I get rid of the part highlighted above? It's a valid error. The 
> user specified the wrong password so I want the error -- I just don't want 
> the path part as a part of that error.  This happens any time there is an 
> error in a script, it prints out information about the author that I don't 
> particularly want published. 
> > 
> > Thanks 
> > 
> > -- 
> > 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...@googlegroups.com . 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Remove path from error messages

2018-10-16 Thread Rich
I apologize if this has been asked before but I searched google and this 
group and didn't find it.  How do you remove the path from the error 
messages?  So I have a valid error:

2018/10/16 18:13:12 [error] in 
main.checkMaster[/Users/rich/go/mysqlrun/mysqlrun.go:739] 
Error 1045: Access denied for user

How do I get rid of the part highlighted above? It's a valid error. The 
user specified the wrong password so I want the error -- I just don't want 
the path part as a part of that error.  This happens any time there is an 
error in a script, it prints out information about the author that I don't 
particularly want published.

Thanks

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: UI in golang

2018-09-03 Thread Rich
I've never worked with it but it looks like GTK might be a good choice.  
It's cross platform and says there is a version for Go.

https://www.gtk.org/language-bindings.php



On Monday, September 3, 2018 at 12:49:12 PM UTC-4, Diego Rocha wrote:
>
> What UI framework are you using in production? I'm trying to do a simple 
> text editor, but actually I don't know what framework I should use. (I'm 
> new to the language and to the world of programming) thanks.
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: My views on Go and why it's better than Scripting

2018-03-06 Thread Rich
I am a systems administrator. I find it easier and faster to write a 
program in Go than it is to script it in Bash.  Since writing scripts is 
something most Sys Admins do I've had to write them in Perl, PHP, TCL, 
Ruby, etc. and the BIGGEST frustration is that I would get a script written 
debugged etc. and I'd go to deploy it to the server.   The server doesn't 
use the right version, or doesn't have the right package installed, and 
hours of additional work are done to get your script to work. On a 
production server installing one binary for something like a Nagios alarm I 
can get away with on a production system, I can't just go and start 
apt-getting or yum installing a bunch of new packages.  With Go I install 
the dependancies on MY system -- and that system is a Mac.  Cross compiling 
is trivial (unless the package it used CGO), and I normally generate code 
that will run on Windows, Linux, Mac and the 32 / 64 bit variations, and I 
can copy that one binary on to the system. No DLLs, no installing extra 
packages, it just runs, no dependency or version headaches. 

On Friday, March 2, 2018 at 4:29:45 PM UTC-5, dorival...@gmail.com wrote:
>
> Hi, I could be wrong (please correct me ;-), but here you are what I think 
> about Go:
>
> INTRODUCTION
> Computers and software were initially developed for scientific computing; 
> e.g., ALGOL and FORTRAN from the 1950s! Therefore, several computer 
> languages and libraries have been invented and are used in scientific 
> computing to date.  Nonetheless, when programming a new scientific 
> simulation, the question about computational efficiency versus ease-of-use 
> remains open. Here, we aim to shed light on a suitable answer to this 
> question---TL;DR use Go and Gosl!
>
> One would say that scripting (interpreted) languages might provide the 
> convenient platform for computations as long as care is taken to send 
> intensive tasks to functions pre-compiled with high-performance languages. 
> This strategy fails to create an easy-to-use environment because the 
> programmer needs to think when and where those tasks should go. Considering 
> that this kind of decision is essential for performance, we argue that 
> scripting language is not the best solution.  Furthermore, we argue that 
> scripting is the worst tool for teaching new programmers in scientific 
> computing.
>
> We argue that only experts should use scripting languages (scripts) for 
> computer programming because beginners cannot understand how dangerous the 
> flexibility of scripts can be. For example, the assignment of variables 
> with the same name to different types is often a cause of misunderstandings 
> and failures. To make this problem even worse, failures due to wrong types 
> are not captured at runtime---certainly not at compilation time (there is 
> no compilation time in scripts). In other words, the interpreter is too 
> permissive.  The scientist, if aware (rarely the case with students), will 
> investigate the numerical output and, after much work, will find the source 
> of the error. Therefore, this situation is not ideal. To exemplify, the 
> following is allowed in Python (or Julia---similar syntax):
>
> ```
> a = 1.0
> a = "a" # OK in Python or Julia
> ```
>
> In the following code, Go will detect the error with a message such as 
> `./test.go:5: cannot use "a" (type string) as type float64 in assignment`:
>
> ```
> package main
> func main() {
> a := 1.0
> a = "a" // not accepted in Go
> }
> ```
>
> The problem propagates in scripting languages when developing 
> objected-oriented code. For example, a member data of a class can be 
> entirely modified by `anyone`, `anywhere` in Python! This issue completely 
> defeats the purpose of encapsulation in OOP.
>
> In summary, scripting (e.g., Python) and alike (e.g., Julia, Matlab) 
> languages are excellent for the expert programmer only who can understand 
> what is going on. However, they are very misleading to the beginner. In 
> other words, the strictness of compiled languages DOES help to learn 
> computer programming. Furthermore, the tools for working with compiled 
> language often take advantage of well-defined types. The shift towards type 
> declaration is so apparent that new languages and strategies are being 
> invented to overcome these issues. For example, TypeScript and Javascript 
> (ES6) combined with FlowType have been recently developed and have a fast 
> adoption among web developers. It seems that no new large project will use 
> non-typed Javascript code.
>
> GO LANGUAGE
> Go is a modern programming language created by Google engineers in 2007, 
> including Robert Griesemer, Rob Pike, and Ken Thompson. The language was 
> later made public as open source in 2009. Go has since grown exponentially 
> attracting a large number of co-developers and users. The primary goal 
> leading to the introduction of yet a new language was the combination of 
> efficiency (like C/C++) with ease of 

Re: [go-nuts] [security] Go 1.8.4 and Go 1.9.1 are released

2017-10-06 Thread Rich
On linux / mac I just become root, cd to /usr/local then run this one liner:

Mac:
  curl https://storage.googleapis.com/golang/go1.9.1.darwin-amd64.tar.gz | 
tar zxvf -

Linux64:
  curl https://storage.googleapis.com/golang/go1.9.1.linux-amd64.tar.gz | 
tar zxvf -

That will overwrite the existing /usr/local/go directory.  To check:

~] $ go version
go version go1.9.1 darwin/amd64

On Wednesday, October 4, 2017 at 9:41:00 PM UTC-4, Bakul Shah wrote:
>
> Would it make sense for Go to update itself? Something 
> like "go update " that fetches a platform 
> specific release, does some basic sanity tests and 
> if all goes well, overwrites $GOROOT. 
>

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Re: Graphing libraries in golang

2017-09-28 Thread Rich
Not sure if this applies but I did some graphing using 
this: https://godoc.org/github.com/ajstarks/svgo  

On Wednesday, September 27, 2017 at 8:35:49 PM UTC-4, kortschak wrote:
>
> On Wed, 2017-09-27 at 08:54 -0700, Volker Dobler wrote: 
> > One from https://awesome-go.com/#science-and-data-analysis 
> > probably should fit your needs. Or try looking for R bindings and 
> > run your plots through R. 
>
>
> https://godoc.org/gonum.org/v1/plot for the first and 
> https://godoc.org/github.com/kortschak/arrgh for the second. 
>
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Unmarshal Json

2017-09-26 Thread Rich
I have a json I have to parse, and in that json one of the keys changes 
depending on the data being generated.  For example:

{
  "Servers": {
"IPAddress=10.1.1.123": {
  "name": "DNS Server1",
  "type": "Apache Webserver"
},
"IPAddress=10.1.1.124": {
  "name": "DNS Server",
  "type": "Bind DNS"
},
"IPAddress=10.2.3.43": {
  "name": "Tomcat Server",
  "type": "Java App Server"
}
  }
}

I have no idea what IPAddress is going to equal, so I'm having a hard time 
writing a struct for it.  Any idea how I can parse this JSON?

Thanks!

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Golang, Google App Engine, Windows 10

2017-09-21 Thread Rich
As a Linux guy myself...  Jet Brains makes an IDE for Windows, Linux and 
Mac called Gogland that I find to be a very good IDE.  If forced to use 
Windows, I would install Cygwin which will give you a Linux shell 
environment.  As for compiling, I run a mac and build binaries for Linux / 
Windows all the time.   What I do is create a simple Makefile like this:

all: runcmd

runcmd: runcmd.go
GOOS=linux GOARCH=amd64 go build  -o binaries/linux64/runcmd 
runcmd.go
GOOS=linux GOARCH=386   go build  -o binaries/linux32/runcmd 
runcmd.go
GOOS=windows GOARCH=amd64 go build  -o binaries/win64/runcmd.exe 
runcmd.go
GOOS=windows GOARCH=386 go build  -o binaries/win32/runcmd.exe 
runcmd.go
GOOS=darwin GOARCH=amd64 go build  -o binaries/mac/runcmd runcmd.go

Just type 'Make' and it will build for all platforms   

On Wednesday, September 20, 2017 at 4:31:04 PM UTC-5, Rob Shelby wrote:
>
> Hi all.
>
> I'm having to make 2 transitions in my coding life. 
>
> From PHP to Go, which I'm happy about.
>
> From Linux desktop to Windows 10, which I'm not as happy about.
>
> I love using Google's App Engine so I don't need to worry about servers 
> etc. (Not Compute Engine)
>
> Anyways, any steps, advice, etc to easily code in Go and deploy to GAE.
>
> So far, I've figured that installing and running Go in Bash On Linux, but 
> coding in an IDE in Windows, is the easiest. Then deploy from Bash On 
> Windows.
>
> Does anyone else have a better way?
>
> Thanks!
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Golang, Google App Engine, Windows 10

2017-09-21 Thread Rich
As a Linux guy myself...  Jet Brains makes an IDE for Windows, Linux and 
Mac called Gogland that I find to be a very good IDE.  If forced to use 
Windows, I would install Cygwin which will give you a Linux shell 
environment.  As for compiling, I run a mac and build binaries for Linux / 
Windows all the time.   What I do is create a simple Makefile like this:
GOOS=windows GOARCH=386 go build  -o binaries/win32/runcmd.exe runcmd.go

all: runcmd

runcmd: runcmd.go
GOOS=linux GOARCH=amd64 go build  -o binaries/linux64/runcmd 
runcmd.go
GOOS=linux GOARCH=386   go build  -o binaries/linux32/runcmd 
runcmd.go
GOOS=windows GOARCH=amd64 go build  -o binaries/win64/runcmd.exe 
runcmd.go
GOOS=windows GOARCH=386 go build  -o binaries/win32/runcmd.exe 
runcmd.go
GOOS=darwin GOARCH=amd64 go build  -o binaries/mac/runcmd runcmd.go

Just type 'Make' and it will build for all platforms   


On Wednesday, September 20, 2017 at 4:31:04 PM UTC-5, Rob Shelby wrote:
>
> Hi all.
>
> I'm having to make 2 transitions in my coding life. 
>
> From PHP to Go, which I'm happy about.
>
> From Linux desktop to Windows 10, which I'm not as happy about.
>
> I love using Google's App Engine so I don't need to worry about servers 
> etc. (Not Compute Engine)
>
> Anyways, any steps, advice, etc to easily code in Go and deploy to GAE.
>
> So far, I've figured that installing and running Go in Bash On Linux, but 
> coding in an IDE in Windows, is the easiest. Then deploy from Bash On 
> Windows.
>
> Does anyone else have a better way?
>
> Thanks!
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Monitoring activity stdin / stdout

2017-08-29 Thread Rich
I am trying to think of a way to monitor stdin... I have this small program 
that spawns a bash shell. What I am looking for is to detect inactivity

package main

import (
"os/exec"
"os"
)

func main() {
shellCmd := exec.Command("/bin/bash", "-l")
//shellCmd := exec.Command(mysqlBin, mysqlCmd)
shellCmd.Stdout = os.Stdout
shellCmd.Stdin = os.Stdin
shellCmd.Stderr = os.Stderr
shellCmd.Run()
os.Exit(0)
}


Any idea how I could monitor for inactivity?  So that if the user doesn't 
type anything for a period of time, it can take an action.

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Go 1.9 is released

2017-08-25 Thread Rich
One liner for installing on Linux. You can change the URL in the curl for 
other OS such as Mac, or any Unix like OS:

cd $GOROOT;cd ..;curl 
https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz | sudo tar 
zxvf -;cd;/usr/local/go/bin/go version

if you don't have GOROOT Set:
cd /usr/local;curl 
https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz | sudo tar 
zxvf -;cd;/usr/local/go/bin/go version

That installs into /usr/local/go.  


On Thursday, August 24, 2017 at 6:44:25 PM UTC-4, Chris Broadfoot wrote:
>
> Hello gophers,
>
> We just released Go 1.9.
>
> You can read the announcement blog post here:
>   https://blog.golang.org/go1.9
>
> You can download binary and source distributions from our download page:
>   https://golang.org/dl/
>
> To compile from source using a Git checkout, update to the release with 
> "git checkout go1.9" and build as usual.
>
> To find out what has changed, read the release notes:
>   https://golang.org/doc/go1.9
>
> Thanks to everyone who contributed to the release.
>
> Chris
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Go 1.9 is released

2017-08-25 Thread Rich

One Liner for installing on Linux / Mac or other Unix like OS: (well almost)

1. Become root
2. cd /usr/local
run this command:

curl https://storage.googleapis.com/golang/go1.9.darwin-amd64.tar.gz 2> 
/dev/null | tar zxvf -

Just make sure you change the URL to curl for the OS version you're working 
on. Above is for Mac, on linux I installed it like this:

cd $GOROOT;cd ..;curl 
https://storage.googleapis.com/golang/go1.9.darwin-amd64.tar.gz | sudo tar 
zxvf -

On Thursday, August 24, 2017 at 6:44:25 PM UTC-4, Chris Broadfoot wrote:
>
> Hello gophers,
>
> We just released Go 1.9.
>
> You can read the announcement blog post here:
>   https://blog.golang.org/go1.9
>
> You can download binary and source distributions from our download page:
>   https://golang.org/dl/
>
> To compile from source using a Git checkout, update to the release with 
> "git checkout go1.9" and build as usual.
>
> To find out what has changed, read the release notes:
>   https://golang.org/doc/go1.9
>
> Thanks to everyone who contributed to the release.
>
> Chris
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Go 1.9 is released

2017-08-25 Thread Rich

One Liner for installing on Linux / Mac or other Unix like OS: (well almost)

1. Become root
2. cd /usr/local
run this command:

curl https://storage.googleapis.com/golang/go1.9.darwin-amd64.tar.gz 2> 
/dev/null | tar zxvf -

Just make sure you change the URL to curl for the OS version you're working 
on. Above is for Mac, on linux I installed it like this:

cd $GOROOT;cd ..;curl 
https://storage.googleapis.com/golang/go1.9.darwin-amd64.tar.gz | sudo tar 
zxvf

On Thursday, August 24, 2017 at 6:44:25 PM UTC-4, Chris Broadfoot wrote:
>
> Hello gophers,
>
> We just released Go 1.9.
>
> You can read the announcement blog post here:
>   https://blog.golang.org/go1.9
>
> You can download binary and source distributions from our download page:
>   https://golang.org/dl/
>
> To compile from source using a Git checkout, update to the release with 
> "git checkout go1.9" and build as usual.
>
> To find out what has changed, read the release notes:
>   https://golang.org/doc/go1.9
>
> Thanks to everyone who contributed to the release.
>
> Chris
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Go 1.9 is released

2017-08-25 Thread Rich


9:20 AM (less than a minute ago)


One Liner for installing on Linux / Mac or other Unix like OS: (well almost)

1. Become root
2. cd /usr/local
run this command:

curl https://storage.googleapis.com/golang/go1.9.darwin-amd64.tar.gz 2> 
/dev/null | tar zxvf -

Just make sure you change the URL to curl for the OS version you're working 
on. Above is for Mac, on linux I installed it like this:

cd $GOROOT;cd ..;curl 
https://storage.googleapis.com/golang/go1.9.darwin-amd64.tar.gz | sudo tar 
zxvf -

On Thursday, August 24, 2017 at 6:44:25 PM UTC-4, Chris Broadfoot wrote:
>
> Hello gophers,
>
> We just released Go 1.9.
>
> You can read the announcement blog post here:
>   https://blog.golang.org/go1.9
>
> You can download binary and source distributions from our download page:
>   https://golang.org/dl/
>
> To compile from source using a Git checkout, update to the release with 
> "git checkout go1.9" and build as usual.
>
> To find out what has changed, read the release notes:
>   https://golang.org/doc/go1.9
>
> Thanks to everyone who contributed to the release.
>
> Chris
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Go 1.9 is released

2017-08-25 Thread Rich
One Liner for installing on Linux / Mac or other Unix like OS: (well almost)

1. Become root
2. cd /usr/local
run this command:

curl https://storage.googleapis.com/golang/go1.9.darwin-amd64.tar.gz 2> 
/dev/null | tar zxvf -



On Thursday, August 24, 2017 at 6:44:25 PM UTC-4, Chris Broadfoot wrote:
>
> Hello gophers,
>
> We just released Go 1.9.
>
> You can read the announcement blog post here:
>   https://blog.golang.org/go1.9
>
> You can download binary and source distributions from our download page:
>   https://golang.org/dl/
>
> To compile from source using a Git checkout, update to the release with 
> "git checkout go1.9" and build as usual.
>
> To find out what has changed, read the release notes:
>   https://golang.org/doc/go1.9
>
> Thanks to everyone who contributed to the release.
>
> Chris
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: [Go2] Reflect

2017-08-06 Thread Rich
I don't understand... doesn't Reflect already do this?
https://play.golang.org/p/CIm7aISztv


On Saturday, August 5, 2017 at 12:58:52 PM UTC-4, Gert wrote:
>
> package main
>
> import (
> "fmt"
> "reflect"
> )
>
> func main() {
> x := 4
> v1 := reflect.ValueOf(x)
> fmt.Println("type:", v1.Type())
> v2 := reflect.TypeOf(x)
> fmt.Println("type:", v2)
> }
>
> Kan we have something like this instead please
>
> package main
>
> import (
> "fmt"
> "reflect"
> )
>
> func main() {
> x := 4
> r := reflect(x)
> fmt.Println("type:", r.Type())
> fmt.Println("value:", r.Value(int))
> }
>
> Reflect should be a generic way of Go2, but everytime i need to reflect 
> around a Go1 interface i want to go on a vacation...
>
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Write a program for Linux in Go lang which can run any command (of coder's choice) on another machine (privately or publicly accessible) and prints its output.

2017-04-12 Thread Rich
Let me get you pointed in the right direction. I do this ALL the time. 
First it to learn the Godoc site. Godoc is an awesome site that you can 
search for different community written extensions to go, as well as get 
documentation on the existing go language packages -- if you're going to 
write in go, godoc.org is your best friend. https://www.godoc.org. once 
there search for a tool called 'gexpect' by ThomasRooney.  This will allow 
you to control an ssh session by any user to any system that user has 
access to.  Another way is to use the built in os/exec: cmd := exec.Command(
"/usr/bin/ssh", "-oStrictHostKeyChecking=no", cHost, cHostCmd)

 To get the user's input use fmt.Scanln.  

fmt.Printf("Remote Host: ")
cHost:=fmt.Scanln("\n")
fmt.Printf("Command: ")
cHostCmd:= fmt.Scanln("\n")

On Monday, April 10, 2017 at 6:42:32 PM UTC-4, Owais Hashmi wrote:
>
> Write a program for Linux in Go lang which can run any command (of coder's 
> choice) on another machine (privately or publicly accessible) and prints 
> its output.
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Go Crypto/cipher and DES3 vs Openssl

2017-03-01 Thread Rich
I wrote an app that -- well does more than this but what I want it to do is 
to enable users to change their passwords, so I wrote the 
following: https://play.golang.org/p/RUbm8e_tJY  This seems to work, and i 
get my base64 encrypted password. When I test that against OpenSSL I don't 
get the same results.For example when I ran the code, it gave me this:

Decoded: WSAtwTSTMVydiJLx00ATfp8grl4KbpgB to Abc.1234


So now if I take the WSAtwTSTMVydiJLx00ATfp8grl4KbpgB I should be able to 
decrypt that with OpenSSL:

echo "WSAtwTSTMVydiJLx00ATfp8grl4KbpgB" | openssl des3 -d -nosalt -a 

enter des-ede3-cbc decryption password:
bad decrypt
140331031709344:error:06065064:digital envelope 
routines:EVP_DecryptFinal_ex:bad decrypt:evp_enc.c:539:
>�x�}9L
   �9[


Anyone know of a better way to test to make sure the code is correct and the 
base64 string that comes out can be decrypted by something other than another 
go program?


Thanks,


Rich

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Go UDP performance

2017-02-20 Thread Rich
I would wireshark the data coming in to both sides so that you can see when 
the packet was transmitted, and when it was received by the other side. 
That way you can isolate if it's network or Go.

On Monday, February 20, 2017 at 4:02:28 PM UTC-5, Tharaneedharan 
Vilwanathan wrote:
>
> Hi All,
>
> I am trying to send a lot of UDP packets from Go code but I realized UDP 
> performance is too low. The max I was able to do is about 160Mbps. This is 
> in Ubuntu 16.10 on x86_64 (i7-6700HQ).
>
> I tried to google on this and it looks like this is about the performance 
> we can get. I am a bit surprised.
>
> Am I missing something? Any suggestions on how to improve the performance?
>
> Thanks
> dharani
>
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Pass variables to bash

2017-02-02 Thread Rich
Thanks everyone for your input... I tried HowardCShaw's method before 
posting, but I went back and experimented more with it and found that the 
output was putting all the variables on one line. I separated them all into 
separate lines and it works! 
What I was doing:
exportVar=`
export var1="Foo Bar"
export var2="Bar Foo"
export var3="Far Boo"
...
export var34="ooB raF"
`
fmt.Println(exportVar)

In bash:
myVars=`goSetVar`
eval myVars

myVars would equal all of the lines above on one line.  What I did was just 
put every line with fmt.Println and that seems to work.


On Thursday, February 2, 2017 at 11:23:49 AM UTC-5, Rich wrote:
>
> Hi All,
>
> My dev team did a very bad thing and issued lots of scripts that they 
> wrote source a file that is in clear text which contains usernames / 
> passwords etc.  Without having to re-write a ton of existing bash scripts, 
> I wanted to use Go and have that set the usernames / passwords and 
> introduce some user validation etc. Is there a way for Go to set 
> environment variables that persist to the script that ran the go program? 
> For example:
>
> Go Program SetPass:
>
> package main
>
> import (
> "fmt"
> "os"
>
> )
>
> func main() {
>
>  os.Setenv("MyPass","Abc.1234")
>
> }
>
>
>
> Bash Script:
>
> #!/bin/bash
>
> /usr/local/bin/SetPass
>
> echo $MyPass
>
>
> This is a simplistic example, in the real script I'd do things like look 
> at the user / groups that are running the program to ensure that they've 
> got the rights to run.
>
> Thanks,
>
> Rich
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Pass variables to bash

2017-02-02 Thread Rich
Hi All,

My dev team did a very bad thing and issued lots of scripts that they wrote 
source a file that is in clear text which contains usernames / passwords 
etc.  Without having to re-write a ton of existing bash scripts, I wanted 
to use Go and have that set the usernames / passwords and introduce some 
user validation etc. Is there a way for Go to set environment variables 
that persist to the script that ran the go program? For example:

Go Program SetPass:

package main

import (
"fmt"
"os"

)

func main() {

 os.Setenv("MyPass","Abc.1234")

}



Bash Script:

#!/bin/bash

/usr/local/bin/SetPass

echo $MyPass


This is a simplistic example, in the real script I'd do things like look at 
the user / groups that are running the program to ensure that they've got 
the rights to run.

Thanks,

Rich

-- 
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://groups.google.com/d/optout.


Re: [go-nuts] Parse JSON question

2017-01-30 Thread Rich
Thank you!! That worked brilliantly!

On Monday, January 30, 2017 at 10:39:56 AM UTC-5, Konstantin Khomoutov 
wrote:
>
> On Mon, 30 Jan 2017 07:14:23 -0800 (PST) 
> Rich <rma...@gmail.com > wrote: 
>
> > If I have JSON that looks like this: 
> [...] 
> > > My question is that the JSON I have to parse the IPAddr is not 
> > > always the 
> > same. AND there are 50+ IPAddr= blocks... For example: 
> > 
> > > { 
> > >"value" :  { 
> > >   "IPAddr=10.1.1.12" : { 
> > >  "ReplyTime" : { 
> [...] 
> > >  } 
> > >   }, 
> > >   "IPAddr=10.1.1.145" : { 
> >  "ReplyTime" : { 
> [...] 
> >  } 
> >   } (Keep adding blocks after this) 
>
> Your "value" field can be naturally represented as a map of keys 
> of the form "IPAddr=whatever" to structures of certain type 
> (IpAddress), so just do that [1]: 
>
> >8 
> package main 
> 
> import ( 
> "encoding/json" 
> "fmt" 
> ) 
> 
> type IpAddress struct { 
> ReplyTime struct { 
> AverageTime int `json:"averageTime"` 
> MaxTime int `json:"maxTime"` 
> MinTime int `json:"minTime"` 
> } `json:"ReplyTime"` 
> } 
> 
> type Data struct { 
> Value map[string]IpAddress `json:"value"` 
> } 
> 
> const s = `{ 
> "value": { 
> "IPAddr=10.1.1.145" : { 
> "ReplyTime" : { 
> "minTime" : 42, 
> "maxTime" : 123, 
> "averageTime" : 12 
> } 
> }, 
> "IPAddr=10.1.1.146" : { 
> "ReplyTime" : { 
> "minTime" : 111, 
> "maxTime" : 32, 
> "averageTime" : 15 
> } 
> } 
> } 
> }` 
> 
> func main() { 
> var d Data 
> err := json.Unmarshal([]byte(s), ) 
> if err != nil { 
> panic(err) 
> } 
> fmt.Printf("%v\n", d) 
> } 
> >8 
>
> You can then iterate over the map to enumerate those key/value pairs. 
>
> 1. https://play.golang.org/p/xmrTXb3SFL 
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Parse JSON question

2017-01-30 Thread Rich
If I have JSON that looks like this:
>
> {
>
>"value" :  {
>
>   "IPAddr=10.1.1.12" : {
>
>  "ReplyTime" : {
>
> "minTime" : 0,
>
> "maxTime" : 0,
>
> "averageTime" : 0
>
>  }
>
>   }
>
> }
>
> }
>
> Normally you'd setup a struct: 

> type IpAddress struct {
>
> Value struct {
>
> IPAddr_10_1_1_12 struct {
>
> ReplyTime struct {
>
> AverageTime int `json:"averageTime"`
>
> MaxTime int `json:"maxTime"`
>
> MinTime int `json:"minTime"`
>
> } `json:"ReplyTime"`
>
> } `json:"IPAddr=10.1.1.12"`
>
> } `json:"value"`
>
> }
>
> My question is that the JSON I have to parse the IPAddr is not always the 
same. AND there are 50+ IPAddr= blocks... For example:

> {
>
>"value" :  {
>
>   "IPAddr=10.1.1.12" : {
>
>  "ReplyTime" : {
>
> "minTime" : 0,
>
> "maxTime" : 0,
>
> "averageTime" : 0
>
>  }
>
>   },
>
>   "IPAddr=10.1.1.145" : {

 "ReplyTime" : {

"minTime" : 0,

"maxTime" : 0,

"averageTime" : 0

 }

  } (Keep adding blocks after this) 

} 

}


How would I setup a struct for something like this?
  

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: Go is two times slower than python code?

2016-12-01 Thread Rich
Have you tried searching https://godoc.org for a PCRE that may suite 
better? 
 https://godoc.org/github.com/glenn-brown/golang-pkg-pcre/src/pkg/pcre

On Tuesday, March 9, 2010 at 9:52:16 AM UTC-5, Alex Dong wrote:
>
> I'm writing a simple 'word picker' using golang and python. It
> basically reads a tweeter message from a csv file, tokenize it and put
> the word->id into a map called lexicon.  It turned out that same logic
> took 22 seconds for python 2.6 to finish whereas 57 seconds for
> golang!
>
> Wondering are there anything I've done wrong?
>
> Here is the python code:
> $ cat loader.py
> lexicon = {}
> pnct_ptn = re.compile(r'([\.,\\/\'"\?!=_\)\(\]\[\{\}:;]+|http://[^ ]
> +)')
> def tokenize(s):
> s = pnct_ptn.sub(' ', s)
> return [t for t in s.split() if len(t)>=3]
>
> for line in open("result.csv").readlines():
> parts = line.split(',', 3)
> if len(parts) != 4: continue
> msg = parts[3]
> s  = msg.decode('utf8','ignore').lower()
> for word in tokenize(s):
> if not lexicon.has_key(word):
> unique_words += 1
> lexicon[word] = unique_words
>
> Here is the go code:
> $ cat loader.go
> package main
>
> import (
> "bufio"
> "os"
> "regexp"
> "strings"
> )
>
> var (
> pr, _ = regexp.Compile(`(http://[^ ]+|['".\\,=()*:;?!/]|-)`)//
> pattern for removal
> )
>
> func tokenize(s string) []string {
> ms := pr.ReplaceAllString(strings.ToLower(s), " ")
> return strings.Split(ms, " ", 0)
> }
>
> func main() {
> lex := make(map[string] int)// lexicon
> dic := make(map[int] string)// lookup
> tw  := 0// total
> words
> ps  := false// present
>
> r, _ := os.Open("result.csv", os.O_RDONLY, 0444)
> defer r.Close()
> in := bufio.NewReader(r)
>
> for i := 0; i >= 0; i++ {
> line, err := in.ReadString('\n')
> if err != nil {
> break
> }
>
> parts:= strings.Split(line, ",", 4)
> if len(parts) != 4 {
> continue
> }
>
> ts := tokenize(parts[3])
> for d := 0; d < len(ts); d++ {
> w := ts[d]
> if len(w) < 3 {
> continue
> }
> _, ps = lex[w]
> if ps == false {
> lex[w] = tw
> dic[tw] = w
> tw ++
> }
> }
> }
> }
>
>
> Cheers,
> Alex
>
>

-- 
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://groups.google.com/d/optout.


[go-nuts] Re: [ANN] (GUI) Qt binding which supports Windows / macOS / Linux / Android / iOS / Sailfish OS / Raspberry Pi

2016-11-13 Thread Rich
This looks very well done. I've not done any real programming in it but 
looking over the github it looks like this is well on it's way.  Thank 
you!! i have a few programs I've been meaning to write that needed a 
gui, I'll be giving this a shot.



On Thursday, November 10, 2016 at 3:34:36 PM UTC-5, therecipe wrote:
>
> Hey everyone,
>
> I would like to officially announce the project I'm working on for a while 
> now.
> It's a binding for the Qt framework + some tools to help you with 
> development and deployment of your Qt applications.
>
> The most interesting feature of the Qt framework for the Go community is 
> probably that it can be used to develop native looking GUI applications for 
> various platforms without the need to make platform specific changes to 
> your code.
> Beside the GUI modules Qt also includes: a webengine (chromium), several 
> multimedia functions, access to bluetooth + nfc, access to various hardware 
> sensors, gamepad support, access to position informations and much more ...
> The Qt article on wikipedia: https://en.wikipedia.org/wiki/Qt_(software)
>
>
> There are two caveats for those who intent to use the binding:
>
> 1. You code won't be pure Go anymore, as this binding heavily relies on 
> cgo.
> 2. The binding dynamically links to Qt's libraries, which results in 
> 25-50mb (depending on the platform) uncompressed libs that have to be 
> deployed along with you binary.
> (But it's also possible to link against the static Qt libs and remove this 
> need. And there is also work being done to reduce the size of the dynamic 
> libs in the upcoming versions of Qt.)
>
>
> For the pro side, I should probably mention that:
>
> 1. The deployment to most platforms is pretty trivial (that includes cross 
> compiling). (And there will be even more supported platforms in the future)
> 2. That the binding is almost complete and already supports most Qt 
> modules (30+).
> 3. There are a lot of examples to get you started. (And porting over 
> existing C++ examples should be super simple)
>
>
> If someone is interested in testing it out, it can be found here:
> https://github.com/therecipe/qt
>
>
> Or if you just want to take a quick look and test the examples on Linux 
> and you are familiar with Docker.
> You could use one of the images as well: `docker pull therecipe/qt:base`
> And simply run `qtdeploy build desktop` in one of the `$GOPATH/src/
> github.com/therecipe/qt/internal/examples/` 
>  sub-sub folders. 
> (inside the container)
> There will be a new folder created called `deploy`, which should contain 
> everything that is needed to run the application on a regular 64-bit Linux 
> system.
>
>
> Please let me know what you think.
> Any feedback is welcome :)
>

-- 
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://groups.google.com/d/optout.


[go-nuts] issue with sending JSON via HTTP

2016-10-25 Thread Rich
Hi All,

I have code that is similar to this:
https://play.golang.org/p/zZ8EQ-R6cb

When I run it I get the following error:
2016/10/25 12:19:56 Body: 400 {"message":"The JSON stream reader doesn't 
support chunking."}

So I changed my code to this:
https://play.golang.org/p/NYV5SdCtnt

and I get the following error:
2016/10/25 12:28:28 Body: 400 {"message":"Expecting an array or an object."}

This curl command is successful:
curl -vv -u m11...@myjob.com:mypas$ -H 'Content-Type:application/json' -X 
POST -d @/home/m1/helloworld.json 
http://someupload.myjob.com:8080/events/com.myjob.upload


helloworld.json looks like this:
{
  "Name": "Operational Demo MR",
  "greeting": "Hello  World"
}

I am not sure what it's looking for... any help would be appreciated. 


-- 
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://groups.google.com/d/optout.


[go-nuts] [ANN] Leader Election library using Zookeeper

2016-08-10 Thread Rich Youngkin
Hi all,

go-leaderelection <https://github.com/Comcast/go-leaderelection> (
https://github.com/Comcast/go-leaderelection) provides the capability for a 
set of distributed processes to compete for leadership for a shared 
resource. It is implemented using Zookeeper for the underlying support. It 
provides a simple, asynchronous, interface. goroutines or processes can 
create an election, compete for becoming the leader for a resource, 
asynchronously wait to become a resource, resign leadership, and delete an 
election resource.

Of note is the project's dependence on go-zookeeper 
<https://github.com/samuel/go-zookeeper>
 (https://github.com/samuel/go-zookeeper) and goint 
<https://github.com/Comcast/goint> (https://github.com/Comcast/goint). 
This, along with other usage information, is covered in the README.

As this is my first golang project I'd appreciate feedback, improvements, 
bug reports, etc.

Cheers,
Rich

-- 
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://groups.google.com/d/optout.


[go-nuts] Linking c libraries

2016-08-04 Thread Rich
I have an issue in that I wrote this application that uses 
github.com/mattn/go-oci8 and it runs on Linux x64. I get the following 
error: "error while loading shared libraries: libclntsh.so.11.1"  How can I 
compile it so that when run the executable will look to a specific path for 
the libraries?  I could set the LD_LIBRARY_PATH but I would rather look to 
another method.

Thanks,

-- 
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://groups.google.com/d/optout.