Re: [go-nuts] where is GOROOT set?

2022-11-17 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2022-11-17 at 21:20 -0800, pat2...@gmail.com wrote:
> pfarrell@Alien15:~/whome/sandbox/gows/src/github.com/pfarrell51/cmd$
> go test treesort_test.go

This is not how go test should be invoked. You just need to do go test
in the directory that you package lives in.

See https://pkg.go.dev/cmd/go#hdr-Test_packages

-- 
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/b90053253a8db89fd84e5bedc477fe306d361380.camel%40kortschak.io.


Re: [go-nuts] where is GOROOT set?

2022-11-17 Thread pat2...@gmail.com
Here I clear it, same result:

pfarrell@Alien15:~/whome/sandbox/gows/src/github.com/pfarrell51/cmd$ export 
GOROOT=
pfarrell@Alien15:~/whome/sandbox/gows/src/github.com/pfarrell51/cmd$ 
printenv GOROOT

pfarrell@Alien15:~/whome/sandbox/gows/src/github.com/pfarrell51/cmd$ go 
test treesort_test.go
# command-line-arguments
treesort_test.go:11:2: package treesort is not in GOROOT (C:\Program 
Files\Go\src\treesort)
FAILcommand-line-arguments [setup failed]
FAIL

Interesting: even though I cleared it to bash, it still shows up as being 
set in go

pfarrell@Alien15:~/whome/sandbox/gows/src/github.com/pfarrell51/cmd$ go env
set GO111MODULE=
set GOENV=C:\Users\pfarrell\AppData\Roaming\go\env
set GOPATH=C:\Users\pfarrell\go
set GOROOT=C:\Program Files\Go

-- 
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/3731200a-4cca-496c-b715-c06980679917n%40googlegroups.com.


Re: [go-nuts] where is GOROOT set?

2022-11-17 Thread Ian Lance Taylor
On Thu, Nov 17, 2022 at 8:59 PM pat2...@gmail.com  wrote:
>
> I'm missing something fundamental.
> I have set GOROOT to my current directory, which contains my go source files
> but I can't test a trivial program

In general you should never set GOROOT.  It's a special purpose hook
that is almost never needed.

What happens if you don't set it in the environment?

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/CAOyqgcVLySgYRTUAenSMwMKT5ULe-Ju5KeNgpCdxY5HDgAFoHQ%40mail.gmail.com.


[go-nuts] where is GOROOT set?

2022-11-17 Thread pat2...@gmail.com
I'm missing something fundamental.
I have set GOROOT to my current directory, which contains my go source files
but I can't test a trivial program

treesort_test.go:11:2: package treesort is not in GOROOT (C:\Program 
Files\Go\src\treesort)

It looks like the value of the GOROOT variable is set to a different value
inside go itself, and not to the value that the shell sees.

(the program is treesort from the Kernigan and Donovan book)
// Copyright © 2016 Alan A. A. Donovan & Brian W. Kernighan.
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
// See page 101.

Sorry for the long PWD, but I'm trying to keep these trivial programs in 
github
and the path seems to be required.

pfarrell@Alien15:~/whome/sandbox/gows/src/github.com/pfarrell51/cmd$ echo 
$GOROOT
/home/pfarrell/whome/sandbox/gows/src/github.com/pfarrell51/cmd


pfarrell@Alien15:~/whome/sandbox/gows/src/github.com/pfarrell51/cmd$ go 
test treesort_test.go
# command-line-arguments
treesort_test.go:11:2: package treesort is not in GOROOT (C:\Program 
Files\Go\src\treesort)
FAILcommand-line-arguments [setup failed]
FAIL
pfarrell@Alien15:~/whome/sandbox/gows/src/github.com/pfarrell51/cmd$ echo 
$GOROOT
/home/pfarrell/whome/sandbox/gows/src/github.com/pfarrell51/cmd



pfarrell@Alien15:~/whome/sandbox/gows/src/github.com/pfarrell51/cmd$ 
printenv GOROOT
/home/pfarrell/whome/sandbox/gows/src/github.com/pfarrell51/cmd

This has to be something trivial that I'm doing wrong
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/75010da9-b72d-4818-80cf-84b622b67f57n%40googlegroups.com.


[go-nuts] X509 subject attributes are encoded as PRINTABLESTRING instead of UTF8STRING

2022-11-17 Thread Atul Mundlik
Hi All,
First post on the group,

I am using  go version go1.18.4 darwin/arm64.
I am trying to create X509 certificate with following code.

var COMMON_NAME = asn1.ObjectIdentifier([]int{2, 5, 4, 3})
 serial := new(big.Int).SetUint64(1)

subjectExtraNames = append(subjectExtraNames, 
pkix.AttributeTypeAndValue{Type: COMMON_NAME, Value: "golang"})

caCertTemplate := &x509.Certificate{
SerialNumber: 1,
IsCA: true,
NotBefore: time.Now(),
Subject: pkix.Name{ExtraNames: pkixAttrTypeValue},
NotAfter: time.Now().AddDate(10, 0, 0),

KeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
BasicConstraintsValid: true,
}

when I inspect the created certificate using asn1parse -in 

   31:d=4  hl=2 l=  13 cons: SEQUENCE  
   33:d=5  hl=2 l=   3 prim: OBJECT:commonName
   38:d=5  hl=2 l=   6 prim: *PRINTABLESTRING*   :golang
the common name is *PRINTABLESTRING* and not the *UTF8STRING.*

As i understand, golang strings are utf8 default then why it is not *UTF8STRING 
?*

However, in above code when i use below to create certificate
subjectExtraNames = append(subjectExtraNames, 
pkix.AttributeTypeAndValue{Type: COMMON_NAME, Value: "é um"})
and when I inspect certificate then it shows *UTF8STRING *for* é um"*

If this is how it is then is there a way to get a string without special 
characters as *UTF8STRING *in certificate?




-- 
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/f4c04b42-143c-4427-a4dc-c589e6cbeaa5n%40googlegroups.com.


[go-nuts] [ANN] go-xmlstruct: generate Go structs from multiple XML documents

2022-11-17 Thread twp...@gmail.com
There are a few existing XML document-to-Go struct generators, but none of 
them had all of the following features:

* Taking multiple XML documents as input.
* Generating correct field types.
* Customizable field names.
* Handling optional and repeated elements.
* Ignoring whitespace.

If you need to handle XML documents in Go then check out 
https://github.com/twpayne/go-xmlstruct.

-- 
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/6d3544b0-1d83-4cb5-9b03-b1ef03aeac7en%40googlegroups.com.


Re: [go-nuts] Re: Retrieve Path Parameters using inbuild http/Net package

2022-11-17 Thread Stéphane Jeandeaux
Hi,

Path parameters: http://
/path_parameter_1/path_parameter_2/?query_param1=...
The default library does not handle path parameters.

If you don't want to use an external library, you can implement your own
parsing by using url.EscapedPath.

On Thu, Nov 17, 2022 at 9:23 AM Peter Galbavy  wrote:

> If you look in the http.Request passed to your handler, there is a URL
> field - use the net/url package to pull this out:
>
> https://pkg.go.dev/net/url#URL
>
> On Wednesday, 16 November 2022 at 09:08:38 UTC squadglad...@gmail.com
> wrote:
>
>> Hello Everyone,
>>
>> I'm developing a http server using inbuilt http/net package in golang.
>> Is there any way to get the path parameters from end points without using
>> any external third-party web framework?
>>
>> 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/acba5b94-0f4e-4034-ae48-c407675d411fn%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/CAGZeQSLO4i%2B1SJro%3DBRcB5dECxrLZuui5fh9ZLqHh1-5K6zq1w%40mail.gmail.com.


[go-nuts] Re: Retrieve Path Parameters using inbuild http/Net package

2022-11-17 Thread Peter Galbavy
If you look in the http.Request passed to your handler, there is a URL 
field - use the net/url package to pull this out:

https://pkg.go.dev/net/url#URL

On Wednesday, 16 November 2022 at 09:08:38 UTC squadglad...@gmail.com wrote:

> Hello Everyone,
>
> I'm developing a http server using inbuilt http/net package in golang.
> Is there any way to get the path parameters from end points without using 
> any external third-party web framework?
>
> 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/acba5b94-0f4e-4034-ae48-c407675d411fn%40googlegroups.com.