First, there is no such requirement in the OP's original post and there is
no mention whether the output is going to be used for another processing
that requires character escaping. The correctness of a solution is judged
against its requirements.
Second, judging from the OP's question, it appe
On Saturday, 8 August 2020 at 01:33:59 UTC+2 Patrick Smith wrote:
> if we think it likely that a future version of Go will allow operator
> overloading
>
That's highly unlikely: https://golang.org/doc/faq#overloading
--
You received this message because you are subscribed to the Google Groups
On Wed, 2019-10-09 at 06:02 -0700, Nalin Pushpakumara wrote:
> Hi,
> I tried to print array with brackets and commas in golang. I want to
> get
> array like this.
> ["record1", "record2". "record3"]
>
> Does anyone know how to do it?
>
> Thank you
>
Not the most efficient, but simple and clear
On Fri, Aug 7, 2020 at 7:46 PM Henry wrote:
> Or you can do it manually:
>
> func print(array []string) string {
> var buffer strings.Builder
> buffer.WriteString("[")
> for index, item := range array {
> if index != 0 {
> buffer.WriteString(", ")
> }
> buffer.WriteString("\"" + item + "\"")
> }
Or you can do it manually:
func print(array []string) string {
var buffer strings.Builder
buffer.WriteString("[")
for index, item := range array {
if index != 0 {
buffer.WriteString(", ")
}
buffer.WriteString("\"" + item + "\"")
}
buffer.WriteString("]")
return buffer.String()
}
On Wednesday, O
Or you can do it manually:
func print(array []string) string {
var buffer strings.Builder
buffer.WriteString("[")
for index, item := range array {
if index != 0 {
buffer.WriteString(", ")
}
buffer.WriteString("\"" + item + "\"")
}
buffer.WriteString("]")
return buffer.String()
}
On Wednesday, O
On Fri, Aug 7, 2020 at 7:54 PM Robert Engels wrote:
>
> I’d really like to see an example of generic code that takes both string and
> numeric types that uses operators. Sorting/searching is one but as I already
> said the built in string operators are not sufficient for collation cases.
>
> Eve
I’d really like to see an example of generic code that takes both string and
numeric types that uses operators. Sorting/searching is one but as I already
said the built in string operators are not sufficient for collation cases.
Even generic code that “only works on unsigned types”.
More than
All the ordering required is explicit in the representation. If x is an
argument of y, then x must come before y (in the eventual assembly output).
There is no other need for ordering within a basic block. Any order
consistent with the argument ordering I mentioned above is ok.
On Friday, August
Operator overloading will never -- hopefully -- be implemented. It's a
perfect way to obscurate code. --Kent
On Fri, Aug 7, 2020 at 4:33 PM Patrick Smith wrote:
> I like the second draft for generics. It seems to me a large
> simplification and improvement over the first draft. Considering just
I like the second draft for generics. It seems to me a large
simplification and improvement over the first draft. Considering just
the state of Go today, I would be quite happy with this, even if it's
not perfect. Thanks to Ian, Robert, and everyone else for their work
on this.
Also, I would vote
Hello gophers,
We have just released go1.15rc2, a release candidate version of Go 1.15.
It is cut from release-branch.go1.15 at the revision tagged go1.15rc2.
Please try your production load tests and unit tests with the new version.
Your help testing these pre-release versions is invaluable.
Re
On Thu, Aug 6, 2020 at 11:33 PM Yuan Ting wrote:
>
> I know from README that gollvm does not support race detector. Is there any
> technical problem? Is it possible to use ThreadSanitizer in LLVM to implement
> a workaround race detector in gollvm?
ThreadSanitizer knows a great deal about the b
On Fri, Aug 7, 2020 at 12:47 AM Yonatan Gizachew wrote:
>
> Yeah, but my question is if it is possible to interpose the exported function
Yes, it should be possible.
Ian
> On Friday, August 7, 2020 at 4:25:06 PM UTC+9 Lutz Horn wrote:
>>
>> Am 07.08.20 um 09:05 schrieb Yonatan Gizachew:
>> >
On Thu, Aug 6, 2020 at 10:13 PM wrote:
>
> I read somewhere (Very sorry I couldn't get the link now) that golang uses
> libc to implement syscalls when the code is built in c-shared mode. I want to
> check if this true.
When writing to this mailing list, please always send code as plain
text or
On Thu, Aug 6, 2020 at 7:30 PM wrote:
>
> having fun with generics I stumbled upon this failure:
> https://go2goplay.golang.org/p/Dc3tWrd6RzQ
>
> Bryan C. Mills helped me to fix it by forcing the type at the call point.
> (the comment in the code)
>
> Forcing a type on a var you just declared is
https://github.com/golang/go/blob/master/src/cmd/compile/internal/ssa/block.go#L60
in my opinion, the values are like instructions, why can it be unordered?
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop r
On Thu, Aug 6, 2020 at 7:23 PM wrote:
>
> I'm quite happy about the generics so far, but now I'm trying some ideas that
> I don't know if they are possible or not given the current proposal.
> My idea, is to create some kind of generic handler for "net/http" that could
> be used in a whole proje
Thanks. clear now.
在2020年8月7日星期五 UTC+8 上午1:00:51 写道:
> On Thu, Aug 6, 2020 at 7:49 AM HailangGe wrote:
> >
> > Recently I was trying to understand how asynchronous preemption is
> implemented in Go 1.14 and
> > basically figured out the call chain.
> >
> > sysmon
> > ↓
> > retake
> > ↓
> > pree
Thank you guys, your tips were really helpful!
Here's the solution I came up with for reading the ECN bits:
After setting the IP_RECVTOS options
syscall.SetsockoptInt(int(fd), syscall.IPPROTO_IP, syscall.IP_RECVTOS, 1)
one can read packets from the socket using
n, oobn, flags, addr, err := conn.Re
To grow a slice, as a programmer you would do:
myslice = append(myslice, value)
myslice = append(myslice, anotherslice...)
Or you can do this my hand, by allocating a new slice of the required size,
and copying the elements you want to keep.
There is a great overview of how this works
Well, it says "lock_futex.go:152:2: ns declared but not used". An unused
variable is a compile error in Go.
On Friday, 7 August 2020 at 09:54:23 UTC+2 Yosef Yo wrote:
> /home/nn/Downloads/go/src/runtime/lock_futex.go:152:2: ns declared but not
> used
>
> go tool dist: FAILED
>
--
You received
I wanted to edit one file from the runtime library and build golang from
the source (golang version 1.10.4). Without modifying the source code, the
build process finished successfully passing all the tests., but after
modifying it, the following error appears.
nn@nn-B85M-D3H:~/Downloads/go/sr
Yeah, but my question is if it is possible to interpose the exported
function
On Friday, August 7, 2020 at 4:25:06 PM UTC+9 Lutz Horn wrote:
> Am 07.08.20 um 09:05 schrieb Yonatan Gizachew:
> > //export Test
> > func Test() {
> > fmt.Println("test code")
> > }
>
> Yes, now `Test` is exported.
>
>
Yeah, but my question if interposing this function is possible?
On Friday, August 7, 2020 at 4:25:06 PM UTC+9 Lutz Horn wrote:
> Am 07.08.20 um 09:05 schrieb Yonatan Gizachew:
> > //export Test
> > func Test() {
> > fmt.Println("test code")
> > }
>
> Yes, now `Test` is exported.
>
> Lutz
>
--
Y
Am 07.08.20 um 09:05 schrieb Yonatan Gizachew:
//export Test
func Test() {
fmt.Println("test code")
}
Yes, now `Test` is exported.
Lutz
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails
Okay, thanks for that. What about now?
package main
import (
"C"
"fmt"
)
//export Test
func Test() {
fmt.Println("test code")
}
func main() {
}
On Friday, August 7, 2020 at 3:47:38 PM UTC+9 Lutz Horn wrote:
> Am 07.08.20 um 05:00 schrieb eme...@gmail.com:
> > //export test
> > func test()
27 matches
Mail list logo