Re: [go-nuts] Re: How to make the first character in a string lowercase?

2022-11-04 Thread peterGo
Prithu Adhikary,

As I pointed out earlier, your code only works when the first character is 
ASCII. For example, it does not work for the Greek alphabet, it does not 
work for an empty string.

https://groups.google.com/g/golang-nuts/c/WfpmVDQFecU/m/CQiT04mRAQAJ

Peter

On Friday, November 4, 2022 at 7:57:36 PM UTC-4 Prithu Adhikary wrote:

> May be this?
>
> func main() {
> myString := "LikeThis"
> print(strings.ToLower(myString[:1]) + myString[1:])
> }
> On Friday, 19 June 2020 at 01:48:23 UTC+5:30 leonidas...@gmail.com wrote:
>
>>
>>
>> package main
>>
>> import (
>> "fmt"
>> "unicode"
>>
>> )
>>
>> func main() {
>> fmt.Println(MakeFirstLowerCase("LikeThis")) 
>>
>> }
>>
>> func MakeFirstLowerCase(s string) string {
>> if len(s)==0 {
>>return s
>> }   
>> 
>> r := []rune(s)
>> r[0] = unicode.ToLower(r[0])
>> return string(r)   
>> }
>>
>> On Thu, Jun 18, 2020 at 10:38 AM  wrote:
>>
>>> I think all other solutions works fine, but String Builder struct exists 
>>> for the same reason.
>>>
>>> package main
>>>
>>> import (
>>> "fmt"
>>> "strings"
>>>
>>> )
>>>
>>> func ToLowerCase(str string) string {
>>>
>>> var b strings.Builder
>>>
>>> b.WriteString(strings.ToLower(string(str[0])))
>>> b.WriteString(str[1:])
>>> 
>>> return b.String()
>>>
>>> }
>>>
>>> func main() {
>>> var str string = "GoLang"
>>> fmt.Println(ToLowerCase(str))
>>> }
>>>
>>>
>>>
>>> Playground here: https://play.golang.org/p/aAyBGnM5p2x
>>>
>>> On Saturday, 24 November 2012 11:51:23 UTC+1, Nikolai wrote:

 Hi!

 What is the easiest way to make a string "LikeThis" --> "likeThis"?

>>> -- 
>>>
>> 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/59ede7f8-bfb9-44a0-9fa7-cef1d7288983o%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/63dc3d5f-bbc2-4dec-a653-9f74544fa5aen%40googlegroups.com.


Re: [go-nuts] Re: How to make the first character in a string lowercase?

2022-11-04 Thread Prithu Adhikary
May be this?

func main() {
myString := "LikeThis"
print(strings.ToLower(myString[:1]) + myString[1:])
}
On Friday, 19 June 2020 at 01:48:23 UTC+5:30 leonidas...@gmail.com wrote:

>
>
> package main
>
> import (
> "fmt"
> "unicode"
>
> )
>
> func main() {
> fmt.Println(MakeFirstLowerCase("LikeThis")) 
>
> }
>
> func MakeFirstLowerCase(s string) string {
> if len(s)==0 {
>return s
> }   
> 
> r := []rune(s)
> r[0] = unicode.ToLower(r[0])
> return string(r)   
> }
>
> On Thu, Jun 18, 2020 at 10:38 AM  wrote:
>
>> I think all other solutions works fine, but String Builder struct exists 
>> for the same reason.
>>
>> package main
>>
>> import (
>> "fmt"
>> "strings"
>>
>> )
>>
>> func ToLowerCase(str string) string {
>>
>> var b strings.Builder
>>
>> b.WriteString(strings.ToLower(string(str[0])))
>> b.WriteString(str[1:])
>> 
>> return b.String()
>>
>> }
>>
>> func main() {
>> var str string = "GoLang"
>> fmt.Println(ToLowerCase(str))
>> }
>>
>>
>>
>> Playground here: https://play.golang.org/p/aAyBGnM5p2x
>>
>> On Saturday, 24 November 2012 11:51:23 UTC+1, Nikolai wrote:
>>>
>>> Hi!
>>>
>>> What is the easiest way to make a string "LikeThis" --> "likeThis"?
>>>
>> -- 
>>
> 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/59ede7f8-bfb9-44a0-9fa7-cef1d7288983o%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/4c4521fa-3bb8-48c3-bf68-742c248739ddn%40googlegroups.com.


[go-nuts] Re: WebAssembly and Filesystem access

2022-11-04 Thread Brian Candler
Not sure this is what you're looking for, but Go 1.16 introduced an 
abstract filesystem interface:
https://pkg.go.dev/io/fs
https://go.dev/doc/go1.16#fs

"the new testing/fstest  package 
provides a TestFS  function that 
checks for and reports common mistakes. It also provides a simple in-memory 
file system implementation, MapFS , 
which can be useful for testing code that accepts fs.FS implementations."

On Friday, 4 November 2022 at 21:08:09 UTC cho...@google.com wrote:

> Hey all,
>
> I couldn't find a prior thread or other information on the web after a bit 
> of searching, but if this is answered elsewhere I'd appreciate a link to 
> follow.
>
> I am on a project which primarily ships a Go command line interface (CLI), 
> but we have aspirations of using the wasm compilation mode to also 
> distribute a simple webapp version of it, while sharing most of the code.
>
> Currently simple things work perfectly. (To everyone involved with this: 
> great work!) The next big hurdle is the fact that we cache things on disk 
> for later reuse, so  things are failing out-of-the-box any time we attempt 
> to touch the filesystem. Luckily, in our case, the fact that we are 
> touching the filesystem is a bit incidental (its used as a cache for making 
> consecutive CLI invocations faster), and as long as the system was 
> consistent for the lifetime of the main Go process things will work just 
> fine.
>
> We /could/ pass a filesystem object across the codebase, and maybe we will 
> one day we will anyway for some other reasons, but I'd rather not have to 
> do that just to get further with this webapp prototype: it's a lot of 
> tedious plumbing, and there is a nontrivial amount of code to touch.
>
> So instead I decided to try some global-mutable-at-startup variables for 
> things like os.OpenFile, os.Remove, etc, that should be easy to cleanup if 
> we decide not to move forward with the prototype; but even then, there are 
> plenty of random things I have to do to get this to work. I've spent about 
> 2 hours on this direction so far and I keep hitting unexpected roadblocks - 
> thus this email seeking out a new strategy.
>
> Are there any plans to automatically support filesystems on wasm-compiled 
> Go applications? Even an ephemeral, in-memory filesystem would basically 
> solve all of my problems without having to change any code on my end, which 
> would be nice.
>
> In lieu of that, does anyone have any tips about how I could go about 
> doing this in a better way?
>
> -Kevin
>

-- 
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/cb8dd112-0ad6-4f1a-a014-1ae3f121f20an%40googlegroups.com.


Re: [go-nuts] go[runtime.rt0_go]: why should 104 be subtracted from g0 stack 64k?

2022-11-04 Thread Ian Lance Taylor
On Thu, Nov 3, 2022 at 7:46 AM liiux...@gmail.com  wrote:
>
> asm_amd64.s
>
> Please explain why 104 should be subtracted from g0 stack?

Interesting question.  The number 104 appears to date back to the
first implementation of split stacks in
https://go.googlesource.com/go/+/b987f7a757f53f460973622a36eebb696f9b5060.
That change introduces a 104 byte stack guard, and I believe that that
stack guard has been carried forward over the years.  I don't really
know whether it still makes any sense today.  Probably it doesn't.

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/CAOyqgcVk6%3DUcPWChitPDqND4voJQJwc30XGAftzoqdTakCL9yQ%40mail.gmail.com.


Re: [go-nuts] Underscore symbol

2022-11-04 Thread Konstantin Khomoutov
On Fri, Nov 04, 2022 at 04:58:35AM -0700, Canuto wrote:

> I'm just starting out with go ...
> I have searched for lights on this string but without success.
> What does this sign mean " _, err " , what the underscore symbol means here?  
> 

If you're starting with Go, please start with the Go Tour [1].
For instance, the use of this underscore sign is covered in [2].

 1. https://go.dev/tour/
 2. https://go.dev/tour/moretypes/17

-- 
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/20221104210943.w2qgygnchfa2kngj%40carbon.


[go-nuts] WebAssembly and Filesystem access

2022-11-04 Thread 'Kevin Chowski' via golang-nuts
Hey all,

I couldn't find a prior thread or other information on the web after a bit 
of searching, but if this is answered elsewhere I'd appreciate a link to 
follow.

I am on a project which primarily ships a Go command line interface (CLI), 
but we have aspirations of using the wasm compilation mode to also 
distribute a simple webapp version of it, while sharing most of the code.

Currently simple things work perfectly. (To everyone involved with this: 
great work!) The next big hurdle is the fact that we cache things on disk 
for later reuse, so  things are failing out-of-the-box any time we attempt 
to touch the filesystem. Luckily, in our case, the fact that we are 
touching the filesystem is a bit incidental (its used as a cache for making 
consecutive CLI invocations faster), and as long as the system was 
consistent for the lifetime of the main Go process things will work just 
fine.

We /could/ pass a filesystem object across the codebase, and maybe we will 
one day we will anyway for some other reasons, but I'd rather not have to 
do that just to get further with this webapp prototype: it's a lot of 
tedious plumbing, and there is a nontrivial amount of code to touch.

So instead I decided to try some global-mutable-at-startup variables for 
things like os.OpenFile, os.Remove, etc, that should be easy to cleanup if 
we decide not to move forward with the prototype; but even then, there are 
plenty of random things I have to do to get this to work. I've spent about 
2 hours on this direction so far and I keep hitting unexpected roadblocks - 
thus this email seeking out a new strategy.

Are there any plans to automatically support filesystems on wasm-compiled 
Go applications? Even an ephemeral, in-memory filesystem would basically 
solve all of my problems without having to change any code on my end, which 
would be nice.

In lieu of that, does anyone have any tips about how I could go about doing 
this in a better way?

-Kevin

-- 
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/557c3a1b-9a21-4721-8e4d-c5225b8043b2n%40googlegroups.com.


Re: [go-nuts] Underscore symbol

2022-11-04 Thread Francesco Bottoni
Means: "just ignore the result at the _ position"





On Fri, Nov 4, 2022, 19:02 Jan Mercl <0xj...@gmail.com> wrote:

> On Fri, Nov 4, 2022 at 6:54 PM Canuto  wrote:
>
> > I'm just starting out with go ...
> > I have searched for lights on this string but without success.
> > What does this sign mean " _, err " , what the underscore symbol means
> here ?
> >
> >  func generateSalt() string {
> >  randomBytes := make([]byte, 16)
> >  _, err := rand.Read(randomBytes)
> >   if err != nil {
> > return "" }
>
> The language specification is the best place where to look for such
> information: https://go.dev/ref/spec#Blank_identifier
>
> --
> 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/CAA40n-WgGJ4uYQ1qG-JDATG06PTWu3D%3DEf-t-PtH_QGOnEr0kQ%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/CAMu-2GKz6y0SUxQr8ajOLFPtZOtmpMksFjYw4DWonPB14KdOHA%40mail.gmail.com.


Re: [go-nuts] Underscore symbol

2022-11-04 Thread Jan Mercl
On Fri, Nov 4, 2022 at 6:54 PM Canuto  wrote:

> I'm just starting out with go ...
> I have searched for lights on this string but without success.
> What does this sign mean " _, err " , what the underscore symbol means here ?
>
>  func generateSalt() string {
>  randomBytes := make([]byte, 16)
>  _, err := rand.Read(randomBytes)
>   if err != nil {
> return "" }

The language specification is the best place where to look for such
information: https://go.dev/ref/spec#Blank_identifier

-- 
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/CAA40n-WgGJ4uYQ1qG-JDATG06PTWu3D%3DEf-t-PtH_QGOnEr0kQ%40mail.gmail.com.


Re: [go-nuts] Re: Unable to create Api | Go Operator | Go issue

2022-11-04 Thread Ian Lance Taylor
This sounds like a question to ask in a Kubernetes group, not here.  This
is a place to ask about the Go language and standard library, not about all
programs written in Go.

Ian

On Fri, Nov 4, 2022, 10:54 AM B K  wrote:

> Any fix for this yet?
>
> On Thursday, 18 November 2021 at 20:19:36 UTC+2 Dinesh kumar Ramasamy
> wrote:
>
>> I do see the same issue - No fix yet.
>>
>> On Monday, November 1, 2021 at 11:30:30 AM UTC-5 Vaishali Gupta wrote:
>>
>>> Hello Team
>>>
>>> getting below error while using below command
>>> could you please help us what can be done to resolve this issue ?
>>>
>>> root@k8sopa1:~/projects/memcached-operator# operator-sdk create api
>>> --group cache --version v1alpha1 --kind Memcached --resource --controller
>>> Writing kustomize manifests for you to edit...
>>> Writing scaffold for you to edit...
>>> api/v1alpha1/memcached_types.go
>>> controllers/memcached_controller.go
>>> Update dependencies:
>>> $ go mod tidy
>>> Running make:
>>> $ make generate
>>> go: creating new go.mod: module tmp
>>> Downloading sigs.k8s.io/controller-tools/cmd/control...@v0.7.0
>>> 
>>> go: downloading github.com/inconshreveable/mousetrap v1.0.0
>>> go: downloading golang.org/x/sys v0.0.0-20210616094352-59db8d763f22
>>> go get: added sigs.k8s.io/controller-tools v0.7.0
>>> /root/projects/memcached-operator/bin/controller-gen
>>> object:headerFile="hack/boilerplate.go.txt" paths="./..."
>>> /usr/local/go/src/net/cgo_linux.go:12:8: no such package located
>>> Error: not all generators ran successfully
>>> run `controller-gen object:headerFile=hack/boilerplate.go.txt
>>> paths=./... -w` to see all available markers, or `controller-gen
>>> object:headerFile=hack/boilerplate.go.txt paths=./... -h` for usage
>>> Makefile:80: recipe for target 'generate' failed
>>> make: *** [generate] Error 1
>>> Error: failed to create API: unable to run post-scaffold tasks of "
>>> base.go.kubebuilder.io/v3": exit status 2
>>> Usage:
>>>   operator-sdk create api [flags]
>>>
>>> Examples:
>>>   # Create a frigates API with Group: ship, Version: v1beta1 and Kind:
>>> Frigate
>>>   operator-sdk create api --group ship --version v1beta1 --kind Frigate
>>>
>>>   # Edit the API Scheme
>>>   nano api/v1beta1/frigate_types.go
>>>
>>>   # Edit the Controller
>>>   nano controllers/frigate/frigate_controller.go
>>>
>>>   # Edit the Controller Test
>>>   nano controllers/frigate/frigate_controller_test.go
>>>
>>>   # Generate the manifests
>>>   make manifests
>>>
>>>   # Install CRDs into the Kubernetes cluster using kubectl apply
>>>   make install
>>>
>>>   # Regenerate code and run against the Kubernetes cluster configured by
>>> ~/.kube/config
>>>   make run
>>>
>>>
>>> Flags:
>>>   --controller   if set, generate the controller without
>>> prompting the user (default true)
>>>   --forceattempt to create resource even if it
>>> already exists
>>>   --group string resource Group
>>>   -h, --help help for api
>>>   --kind string  resource Kind
>>>   --make make generate   if true, run make generate after generating
>>> files (default true)
>>>   --namespaced   resource is namespaced (default true)
>>>   --plural stringresource irregular plural form
>>>   --resource if set, generate the resource without
>>> prompting the user (default true)
>>>   --version string   resource Version
>>>
>>> Global Flags:
>>>   --plugins strings   plugin keys to be used for this subcommand
>>> execution
>>>   --verbose   Enable verbose logging
>>>
>>>
>>>
>>>
>>>
>>> *FATA[0088] failed to create API: unable to run post-scaffold tasks of
>>> "base.go.kubebuilder.io/v3 ": exit status
>>> 2Version which i am using *
>>> root@k8sopa1:~/projects/memcached-operator# kubectl version
>>> Client Version: version.Info{Major:"1", Minor:"22",
>>> GitVersion:"v1.22.3", GitCommit:"c92036820499fedefec0f847e2054d824aea6cd1",
>>> GitTreeState:"clean", BuildDate:"2021-10-27T18:41:28Z",
>>> GoVersion:"go1.16.9", Compiler:"gc", Platform:"linux/amd64"}
>>> The connection to the server localhost:8080 was refused - did you
>>> specify the right host or port?
>>> root@k8sopa1:~/projects/memcached-operator# git version
>>> git version 2.17.1
>>> root@k8sopa1:~/projects/memcached-operator# docker version
>>> Client: Docker Engine - Community
>>>  Version:   20.10.10
>>>  API version:   1.41
>>>  Go version:go1.16.9
>>>  Git commit:b485636
>>>  Built: Mon Oct 25 07:42:57 2021
>>>  OS/Arch:   linux/amd64
>>>  Context:   default
>>>
>>> OS Ubuntu 18.04/ ubuntu 20.04
>>>
>>> Connectivity is fine with proxy
>>>
>>> root@k8sopa1:~/projects/memcached-operator# ping proxy.golang.org
>>> PING proxy.golang.org (172.217.174.81) 56(84) bytes of data.
>>> 64 bytes from bom07s25-in-f17.1e100.net 

[go-nuts] Underscore symbol

2022-11-04 Thread Canuto
Hello everybody,
I'm just starting out with go ...
I have searched for lights on this string but without success.
What does this sign mean " _, err " , what the underscore symbol means here 
?  
   
 func generateSalt() string { 
 randomBytes := make([]byte, 16) 
 _, err := rand.Read(randomBytes)
  if err != nil {  
return "" }


Regards.
   
   
  
  

-- 
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/7cc5559c-7b92-4834-a806-611a2879923bn%40googlegroups.com.


[go-nuts] Re: Unable to create Api | Go Operator | Go issue

2022-11-04 Thread B K
Any fix for this yet?

On Thursday, 18 November 2021 at 20:19:36 UTC+2 Dinesh kumar Ramasamy wrote:

> I do see the same issue - No fix yet. 
>
> On Monday, November 1, 2021 at 11:30:30 AM UTC-5 Vaishali Gupta wrote:
>
>> Hello Team
>>
>> getting below error while using below command 
>> could you please help us what can be done to resolve this issue ?
>>
>> root@k8sopa1:~/projects/memcached-operator# operator-sdk create api 
>> --group cache --version v1alpha1 --kind Memcached --resource --controller
>> Writing kustomize manifests for you to edit...
>> Writing scaffold for you to edit...
>> api/v1alpha1/memcached_types.go
>> controllers/memcached_controller.go
>> Update dependencies:
>> $ go mod tidy
>> Running make:
>> $ make generate
>> go: creating new go.mod: module tmp
>> Downloading sigs.k8s.io/controller-tools/cmd/control...@v0.7.0 
>> 
>> go: downloading github.com/inconshreveable/mousetrap v1.0.0
>> go: downloading golang.org/x/sys v0.0.0-20210616094352-59db8d763f22
>> go get: added sigs.k8s.io/controller-tools v0.7.0
>> /root/projects/memcached-operator/bin/controller-gen 
>> object:headerFile="hack/boilerplate.go.txt" paths="./..."
>> /usr/local/go/src/net/cgo_linux.go:12:8: no such package located
>> Error: not all generators ran successfully
>> run `controller-gen object:headerFile=hack/boilerplate.go.txt paths=./... 
>> -w` to see all available markers, or `controller-gen 
>> object:headerFile=hack/boilerplate.go.txt paths=./... -h` for usage
>> Makefile:80: recipe for target 'generate' failed
>> make: *** [generate] Error 1
>> Error: failed to create API: unable to run post-scaffold tasks of "
>> base.go.kubebuilder.io/v3": exit status 2
>> Usage:
>>   operator-sdk create api [flags]
>>
>> Examples:
>>   # Create a frigates API with Group: ship, Version: v1beta1 and Kind: 
>> Frigate
>>   operator-sdk create api --group ship --version v1beta1 --kind Frigate
>>
>>   # Edit the API Scheme
>>   nano api/v1beta1/frigate_types.go
>>
>>   # Edit the Controller
>>   nano controllers/frigate/frigate_controller.go
>>
>>   # Edit the Controller Test
>>   nano controllers/frigate/frigate_controller_test.go
>>
>>   # Generate the manifests
>>   make manifests
>>
>>   # Install CRDs into the Kubernetes cluster using kubectl apply
>>   make install
>>
>>   # Regenerate code and run against the Kubernetes cluster configured by 
>> ~/.kube/config
>>   make run
>>
>>
>> Flags:
>>   --controller   if set, generate the controller without 
>> prompting the user (default true)
>>   --forceattempt to create resource even if it 
>> already exists
>>   --group string resource Group
>>   -h, --help help for api
>>   --kind string  resource Kind
>>   --make make generate   if true, run make generate after generating 
>> files (default true)
>>   --namespaced   resource is namespaced (default true)
>>   --plural stringresource irregular plural form
>>   --resource if set, generate the resource without 
>> prompting the user (default true)
>>   --version string   resource Version
>>
>> Global Flags:
>>   --plugins strings   plugin keys to be used for this subcommand 
>> execution
>>   --verbose   Enable verbose logging
>>
>>
>>
>>
>>
>> *FATA[0088] failed to create API: unable to run post-scaffold tasks of 
>> "base.go.kubebuilder.io/v3 ": exit status 
>> 2Version which i am using *
>> root@k8sopa1:~/projects/memcached-operator# kubectl version
>> Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.3", 
>> GitCommit:"c92036820499fedefec0f847e2054d824aea6cd1", GitTreeState:"clean", 
>> BuildDate:"2021-10-27T18:41:28Z", GoVersion:"go1.16.9", Compiler:"gc", 
>> Platform:"linux/amd64"}
>> The connection to the server localhost:8080 was refused - did you specify 
>> the right host or port?
>> root@k8sopa1:~/projects/memcached-operator# git version
>> git version 2.17.1
>> root@k8sopa1:~/projects/memcached-operator# docker version
>> Client: Docker Engine - Community
>>  Version:   20.10.10
>>  API version:   1.41
>>  Go version:go1.16.9
>>  Git commit:b485636
>>  Built: Mon Oct 25 07:42:57 2021
>>  OS/Arch:   linux/amd64
>>  Context:   default
>>
>> OS Ubuntu 18.04/ ubuntu 20.04
>>
>> Connectivity is fine with proxy
>>
>> root@k8sopa1:~/projects/memcached-operator# ping proxy.golang.org
>> PING proxy.golang.org (172.217.174.81) 56(84) bytes of data.
>> 64 bytes from bom07s25-in-f17.1e100.net (172.217.174.81): icmp_seq=1 
>> ttl=113 time=26.0 ms
>> 64 bytes from bom07s25-in-f17.1e100.net (172.217.174.81): icmp_seq=2 
>> ttl=113 time=23.4 ms
>> 64 bytes from bom07s25-in-f17.1e100.net (172.217.174.81): icmp_seq=3 
>> ttl=113 time=24.4 ms
>> 64 bytes from bom07s25-in-f17.1e100.net (172.217.174.81): icmp_seq=4 
>> ttl=113 

Re: [go-nuts] fs.Glob, fs.DirWalk, etc. does the pattern support complex regex

2022-11-04 Thread pat2...@gmail.com
Thanks to all who replied.
On Friday, November 4, 2022 at 8:47:51 AM UTC-4 Konstantin Khomoutov wrote:

> On Thu, Nov 03, 2022 at 01:20:16PM -0700, pat2...@gmail.com wrote:
>
> > This has to be a FAQ, but my google foo for searching it is not clear
> > The docs say: " The syntax of patterns is the same as in path.Match."
> > 
> > The pattern seems to implement only fairly simple search expressions.
> > 
> > I'd like to search for "./*.MP4", but of course to be platform 
> independant
> > I have to search for both upper and lower case "mp4" and "MP4" 
> > and maybe even allow "Mp4".
> > 
> > This is trivial in most regex, including go's regex
> > 
> > Can I do this with Glob or DirWalk? Or do I need to just
> > get the file names and manually apply the regex?
>
> The latter.
>
> But please note that I, for one, have not heard of any popular filesystem
> on a platform Go runs on which would support regexp matching when 
> traversing
> its entries, and fs.Glob is largely modelled after what Unix shells 
> implement.
> Hence basically if something like fs.Regexp were introduced, it would 
> anyway
> need to walk the hierarchy and apply the supplied regexp to each pathname 
> it
> visits.
>
> Please also note that using a regexp for what you're after looks like an
> overkill to me: a simple
>
> strings.EqualFold(filepath.Ext(fname), "mp4")
>
> in the callback function to fs.WalkDir wold convey the intent better, IMO.
>
> In any case, such a callback function to find a bunch of files matching 
> their
> extensions in a case-insensitive manner would clock at 10-15 lines, I'd 
> say.
>

-- 
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/678cd07c-0c13-49fe-b5b5-d417351bbaf9n%40googlegroups.com.


Re: [go-nuts] fs.Glob, fs.DirWalk, etc. does the pattern support complex regex

2022-11-04 Thread Konstantin Khomoutov
On Thu, Nov 03, 2022 at 01:20:16PM -0700, pat2...@gmail.com wrote:

> This has to be a FAQ, but my google foo for searching it is not clear
> The docs say: " The syntax of patterns is the same as in path.Match."
> 
> The pattern seems to implement only fairly simple search expressions.
> 
> I'd like to search for "./*.MP4", but of course to be platform independant
> I have to search for both upper and lower case "mp4" and "MP4" 
> and maybe even allow "Mp4".
> 
> This is trivial in most regex, including go's regex
> 
> Can I do this with Glob or DirWalk? Or do I need to just
> get the file names and manually apply the regex?

The latter.

But please note that I, for one, have not heard of any popular filesystem
on a platform Go runs on which would support regexp matching when traversing
its entries, and fs.Glob is largely modelled after what Unix shells implement.
Hence basically if something like fs.Regexp were introduced, it would anyway
need to walk the hierarchy and apply the supplied regexp to each pathname it
visits.

Please also note that using a regexp for what you're after looks like an
overkill to me: a simple

  strings.EqualFold(filepath.Ext(fname), "mp4")

in the callback function to fs.WalkDir wold convey the intent better, IMO.

In any case, such a callback function to find a bunch of files matching their
extensions in a case-insensitive manner would clock at 10-15 lines, I'd say.

-- 
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/20221104124713.vlglr7fm6azkxpap%40carbon.


Re: [go-nuts] Re: about upstream?

2022-11-04 Thread Chris Burkert
I am also not a native speaker, but having a stream/river in mind, then
upstream seems to be where the water comes from and downstream where the
water is going to.
However, the OP mentioned that one micro service called the other which
tells me something about how the connection is established, but that does
not tell me how data is actually "flowing". Maybe in both directions :-)

Am Do., 3. Nov. 2022 um 22:18 Uhr schrieb TheDiveO :

> I've seen both usages depending on the writers' perspectives. For that
> reason I avoid the terms upstream and downstream in this context (services)
> like the plague and always ask people for clarification without using these
> two words. It's always fun to see this then sparking totally surprised
> reaction in others taking part in those conversations.
>
> The OP is perfectly right to ask this usinthe term "up/downstream" in the
> context of services, as I've seen and heard this often times for REST-based
> APIs, both from native as well as non-native speakers.
>
> On Wednesday, November 2, 2022 at 10:15:51 AM UTC+1 cuiw...@gmail.com
> wrote:
>
>> there are two micro service writen in go, let's call them A and B. A will
>> call B. In this scene we will call B is the upstream of A. or A is the
>> upstream of B? which one is correct way?
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/80af4dc5-3c18-4f2a-a52b-026a93d0dac8n%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/CALWqRZp40tBrq8T_EJT9hqUcb4tk%3DezbbZedU8H%2BLatLgHgiaw%40mail.gmail.com.


Re: [go-nuts] Go Crashes on a long running process (with stack trace)

2022-11-04 Thread Konstantin Khomoutov
On Tue, Nov 01, 2022 at 10:14:28AM -0700, Vineet Jain wrote:

> We have a long running process that listens to and processes a large number 
> of network packets. It died today with the following stack trace. Anyone 
> seen this before, or have any idea what is causing it?
> 
> Nov 01 12:40:30  sv_svc[100448]: I1101 12:40:30.865268  100448 
> stratconn.go:83] Message Sequence(109845000): Q Length(1)
> Nov 01 12:40:31  sv_svc[100448]: n on lineno rlimitpanicwrap: unexpected 
> string after ty
> Nov 01 12:40:31  sv_svc[100448]: 
> erfreecr1742248535156257105427357601001nTpUpd0x1NFOTyp0x0 pc=0x0]
> Nov 01 12:40:31  sv_svc[100448]: goroutine 4 [wner di]:
> Nov 01 12:40:31  sv_svc[100448]: runtime.throw({0x75b1b0?, 0x0?})
> Nov 01 12:40:31  sv_svc[100448]: /go/src/runtime/panic.go:1047 +0x5d 
> fp=0xcc8080 sp=0xcc8050 pc=0x436a1d
> Nov 01 12:40:31  sv_svc[100448]: runtime: g 4invalid use of 
> scannermalforuntime.sigpanic_ERRORGC scav0x0
[...]

The stack trace looks pretty suspicious because it itself appears to be
corrupted as certain prhases are missing letters in the words or have
different letters instead of "expected" ones.

I can conjure that may be that's just some person typed the text while looking
at the screen - instead of copying and pasting. Or maybe you have run the
"search and replace" operation on the stack trace's text, and it replaced more
stuff than was intended.
But I'm asking because if it really was copied and pasted, I'd propose you
either had a memory corruption in your process - for instance, because of
misbehaving C library code linked to the program or a bug in the code using
the `unsafe` package - directly or indirectly.

Still, these tree lines

| I1101 12:40:30.865268  100448 stratconn.go:83] Message Sequence(109845000): Q 
Length(1)
| n on lineno rlimitpanicwrap: unexpected string after ty
| erfreecr1742248535156257105427357601001nTpUpd0x1NFOTyp0x0 pc=0x0]

(I have stripped the logger prefixes from them for brewity)

look like a manifestation of a "normal" panic from the application's code
or the code of one of the libraries it uses. The clues are:

 - stratconn.go does not appear to be a file from the stdlib "net" package.

 - The "rlimitpanicwrap" cannot be found in the Go runtime's source code.
   Judging from the name, I'd say it's some sort of a handler to catch
   panics and do something; I guess, attach the stack trace to them and
   maybe bubble them up or whatever. It's not really relevant to the issue
   at hand, though.

 - The guru meditation string "Message Sequence(109845000): Q Length(1)"
   appears to be related to parsing of the protocol your application
   may be using.

Based on this evidence, I'd say you have merely found a regular bug in your
code.

Still, I need to confess that

| runtime: g 4invalid use of scannermalforuntime.sigpanic_ERRORGC scav0x0

looks scary and related to the runtime.
The problem is that 1) the message text appearch to be damaged, as I've
already stated, and 2) I fail to find even the piecs of this string in the Go
runtime source code.


That said, asking such question w/o stating the Go flavor used to build the
program, and its exact version is useless. Including at least some details
about the runtime environment (GOOS and GOARCH) would not harm, either.

-- 
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/20221104110033.yjfmnsh6xvl72rbx%40carbon.


Re: [go-nuts] godoc and generic code

2022-11-04 Thread Marcel Huijkman
Perhaps update godoc:
go install golang.org/x/tools/cmd/godoc@latest

On Friday, November 4, 2022 at 7:18:28 AM UTC+1 tapi...@gmail.com wrote:

> You may also try Golds: https://github.com/go101/golds.
> Still not perfect in handling custom generic things,
> but it is generally usable.
>
> On Friday, November 4, 2022 at 1:26:26 AM UTC+8 Hotei wrote:
>
>> Thanks for the very helpful replies. < go doc -all pkg > should meets my 
>> needs for printed documentation.  I guess I will have to weigh the 
>> convenience of navigating which the godoc html version provides vs the 
>> inconvenience of "instantiating" the methods required by the types [T] I 
>> use in this project.  The pkgsite option doesn't seem workable in my case 
>> for the reasons eloquently described by one of the posters to issue 49212.  
>> At any rate, problem solved and thanks again to the golang-nuts group for 
>> the assistance!
>>
>> On Thursday, November 3, 2022 at 9:32:09 AM UTC-4 Sebastien Binet wrote:
>>
>>> On Thu Nov 3, 2022 at 14:02 CET, Jan Mercl wrote: 
>>> > On Thu, Nov 3, 2022 at 12:49 PM Hotei  wrote: 
>>> > 
>>> > > I added some generic code to a project and godoc doesn't seem to 
>>> like that and stops working when it sees the generics. It's a 4 year old 
>>> version of godoc so that's perhaps not a surprise. What is a surprise is 
>>> that godoc isn't shipped with go any longer. Is there a version that 
>>> handles generics and if so where can I find it? A quick search of github 
>>> came up empty but I know things have been moved around so some hints would 
>>> be much appreciated. 
>>> > 
>>> > I'm not in favor of the fact, but It's been deprecated a year ago: 
>>> > https://github.com/golang/go/issues/49212 
>>>
>>> one can use godocs.io for a maintained "godoc-like" binary: 
>>>
>>> - https://godocs.io/go-hep.org/x/hep/sliceop 
>>> - https://sr.ht/~sircmpwn/godocs.io/ 
>>>
>>> (otherwise, 'go doc' does support "generics") 
>>>
>>> hth, 
>>> -s 
>>>
>>

-- 
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/d407dd97-993f-4511-a373-802c55e4fc70n%40googlegroups.com.


Re: [go-nuts] godoc and generic code

2022-11-04 Thread tapi...@gmail.com
You may also try Golds: https://github.com/go101/golds.
Still not perfect in handling custom generic things,
but it is generally usable.

On Friday, November 4, 2022 at 1:26:26 AM UTC+8 Hotei wrote:

> Thanks for the very helpful replies. < go doc -all pkg > should meets my 
> needs for printed documentation.  I guess I will have to weigh the 
> convenience of navigating which the godoc html version provides vs the 
> inconvenience of "instantiating" the methods required by the types [T] I 
> use in this project.  The pkgsite option doesn't seem workable in my case 
> for the reasons eloquently described by one of the posters to issue 49212.  
> At any rate, problem solved and thanks again to the golang-nuts group for 
> the assistance!
>
> On Thursday, November 3, 2022 at 9:32:09 AM UTC-4 Sebastien Binet wrote:
>
>> On Thu Nov 3, 2022 at 14:02 CET, Jan Mercl wrote:
>> > On Thu, Nov 3, 2022 at 12:49 PM Hotei  wrote:
>> >
>> > > I added some generic code to a project and godoc doesn't seem to like 
>> that and stops working when it sees the generics. It's a 4 year old version 
>> of godoc so that's perhaps not a surprise. What is a surprise is that godoc 
>> isn't shipped with go any longer. Is there a version that handles generics 
>> and if so where can I find it? A quick search of github came up empty but I 
>> know things have been moved around so some hints would be much appreciated.
>> >
>> > I'm not in favor of the fact, but It's been deprecated a year ago:
>> > https://github.com/golang/go/issues/49212
>>
>> one can use godocs.io for a maintained "godoc-like" binary:
>>
>> - https://godocs.io/go-hep.org/x/hep/sliceop
>> - https://sr.ht/~sircmpwn/godocs.io/
>>
>> (otherwise, 'go doc' does support "generics")
>>
>> hth,
>> -s
>>
>

-- 
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/fc14224a-6325-4cd1-a313-af6bfb7e1f67n%40googlegroups.com.