```
package main
import (
"fmt"
"math"
)
func main() {
fmt.Printf("%g\n", 1-(math.Pow(0.6, 1/13))) //result=0
fmt.Printf("%g\n", 1-(math.Pow(0.6, 1.0/13))) // result=0.038532272011602364
}
```
https://go.dev/play/p/oIKGb_uyLb3
--
You received this message because you are subscribed to the Goo
Notararigo wrote:
>
>
> On Thu, Aug 3, 2023, 23:45 DrGo wrote:
>
>> @Miguel Angel Rivera Notararigo
>>
>> Thanks for taking the time to write...
>>
>> In my proposal, people are free to add as much context as they want...
>>
>
> Yeah I know, I li
err error) {
if err != nil {
panic(err)
}
// And use recover somewhere
}
Which is a bad practice, but at least we (the people who like how Go handle
errors) can still handle our errors without any language change.
On Tue, Aug 1, 2023, 13:06 DrGo wrote:
Thanks.
The keystroke saving
wrote:
> Dnia 2023-07-29, o godz. 22:57:15
> DrGo napisał(a):
>
> > This involves introducing a new keyword "orelse" that is a syntactic
> sugar for an "if err!=nil" block.
>
> You can implement it as a snippet under any editor in use today.
>
>
future always ask when it comes to a proposal:
>> which of the two perspectives does the proposal tackle? I'm under the
>> assumption that it might have been #2 in most of the proposals. The often
>> vivid negative responses should then be classified as belonging to #1
>&g
should then be classified as belonging to #1
> and/or #2. If the proposal is about #2, then #1 proponents don't
> contribute, but simply make life hard for the #2 customers of the Go
> language. Same for the opposite combination.
>
> On Wednesday, August 2, 2023 at 6:11:01 P
e,
> and Go already has its share of surprises you have to learn.
>
> On Tuesday, 1 August 2023 at 22:41:38 UTC+1 DrGo wrote:
>
>> Yes. Go is no longer the simple language it was. I suspect because of
>> internal pressures within Google as evidenced by multiple innovations that
e of any other name?
>>
>> I disagree that this makes the job of linters any easier than it is
>> today. For example, if you'd written
>>
>> ...
>>err = io.Copy(w, r)
>> err = w.Close() orelse return err
>> }
>>
>> then you
Fair enough. But many would prefer shorter functions if there is no loss to
explicitness or clarity.
On Tuesday, August 1, 2023 at 11:10:30 AM UTC-6 Stephen Illingworth wrote:
> On Tuesday, 1 August 2023 at 18:06:25 UTC+1 DrGo wrote:
>
> Compare the following; which one would you
Thanks Jan
Indeed the majority can be wrong but in this case the OLD smart minority
too wanted a way to improve things. This approach was in fact dictated by
their requirements
On Tuesday, August 1, 2023 at 2:10:57 AM UTC-6 Jan Mercl wrote:
> On Tue, Aug 1, 2023 at 1:47 AM DrGo wr
d to previous lines of code. But I think this is a direct design
> goal. If the keyword vs lines of code/tokenspace is worth it, so be it.
> Who am I to say. If we are truely circling on a way to handle errors in a
> chain, then the chain aspect is at least as important as any
err := myFunction()
>if err != nill {
>return rest, err
>}
> }
> ```
>
> Op maandag 31 juli 2023 om 04:32:01 UTC+2 schreef DrGo:
>
>> Another possibility Jeremy is that the orelse block is executed if any of
>> the returned error values is n
much work and energy (at least by
> me as an outside observer). Having something which fits within the design
> of the language, making it a developer centric language, would seem to
> fight with any one-line-template approach.
>
> tim
>
>
>
>
>
> The test and
t) and that 'orelse' could be done with
> the existing 'else' keyword, i.e.,
>
> ```
> result, err := someCall() else rest, err
> ```
> Anyway, I really do hope the long-winded error syntax gets solved somehow!
>
> On Monday, July 31, 2023 at 5:41:4
h the third example from the paper,
> which does (proper) error annotation and cleanup. Thanks.
> On Sunday, July 30, 2023 at 8:57:15 AM UTC+3 DrGo wrote:
>
>> I looked at the long list of proposals to improve error handling in go
>> but I have not seen the one I am describing
urn foo }" ??
>
> On Sunday, 30 July 2023 at 10:20:12 UTC+1 Brian Candler wrote:
>
>> On Sunday, 30 July 2023 at 09:40:25 UTC+1 DrGo wrote:
>>
>> orelse must return an error (ie satisfies the error interface); the
>> specific type and variable name do not matte
thanks for the link.
unlike the onErr approach, my proposal does not treat create special-status
identifier; the orelse block is like any other else block
On Sunday, July 30, 2023 at 1:31:09 AM UTC-6 Brian Candler wrote:
On Sunday, 30 July 2023 at 06:57:15 UTC+1 DrGo wrote:
I looked at the
.
err = io.Copy(w, r)
err = w.Close() orelse return err
}
then you'd still need to detect "value assigned but not used" in the linter
(assuming it doesn't become *compulsory* to use "orelse" on any assignment
to a variable called "err")
On Sunday, 30
I looked at the long list of proposals to improve error handling in go but
I have not seen the one I am describing below. If I missed a similar , can
you pls direct me to where I can find it. If not what do you think of this
approach.
This involves introducing a new keyword "orelse" that is a
Dear Lorenzo,
Here’s a link to an old but still relevant tutorial on benchmarking Go
programs
https://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go
Happy benchmarking
On Saturday, February 20, 2021 at 11:19:40 AM UTC-6 TiT8 wrote:
>
> Thank you Volker.
>
> I want to say that I was n
Thanks a million
Totally missed that first err was not limited to the scope of the case or
the go routine.
On Wednesday, January 20, 2021 at 6:02:29 PM UTC-6 Carla Pfaff wrote:
> result <- Event{event, err}
>
> reads the `err` variable in one goroutine, and
>
> err = watcher.Add(dir)
>
>
if I run this program in the playground, I get: timeout running program
Program exited: status 1
https://play.golang.org/p/5cDYasXtl_n
If I run it on my macos Catalina machine with go 1.16 beta I get a data
race warning
```
WARNING: DATA RACE
Read at 0x00c00011a2a0 by goroutine 10:
main.New.f
Of course, once you post about a problem, you immediately figure it out.
I forgot to update the go files in the package folder to reflect the name
change
package liverserver--> package gols fixes the issue.
On Sunday, January 17, 2021 at 10:14:36 PM UTC-6 DrGo wrote:
> Wondering if s
Wondering if someone knows what is going on here:
I renamed a module in go.mod from liverserver [sic] to gols and imported it
in main.go in a "cmd" subdir. Now I am getting this error when I compile
main.go:
./main.go:8:2: imported and not used: "github.com/drgo/gols" as l
I too think that T any is more readable than the overloaded type in type T
especially if it means that I won’t have to remember when it’s Ok to drop
type and when it’s not
On Saturday, July 25, 2020 at 4:47:17 PM UTC-5 Denis Cheremisov wrote:
> Great catch! I would say I really like it!
>
> суб
Hi,
wondering how to unmarshall the xml below (also available
here https://play.golang.org/p/QtZwKmrn8HM) into a tree. The challenge is
that each element can nest 0 or more *ordered* child elements which can be
of different types (eg text, group, choose, macro etc). I tried
unmarshalling into
>
> On 2020-02-21 16:13, Amnon Baron Cohen wrote:
>> >
>> Default connection limits suggest it isn't production ready by default
>> and so is
>> the main reason...so define properly hardened, but also.
>
>
> For an average schmuck like me, "hardened" means that I am not criminally
neglectin
https://blog.gopheracademy.com/advent-2016/exposing-go-on-the-internet/
I found this article very helpful in setting up a hardened https server.
But It dates back to 2016 and go 1.8. Are there more up-to-date
recommendations for go 1.13?
Thanks,
--
You received this message because you are
Hello,
Wondering what I am doing wrong.
Using go13.beta1 (Darwin), I am running a freshly downloaded godoc in a dir
that includes several of my own packages like this
godoc -http=localhost:6060 -goroot ~/local/git/
But on the browser, godoc is simply serving a list of all files in the dir
(no
I suggest that we first solve less controversial issues like the
Israeli–Palestinian conflict.
--
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+unsu
For future reference:
After trying different solutions (some are described in the above posts),
the most performant solution was based on Michael Jones' pcg package (
https://github.com/MichaelTJones/pcg) with a tweaked Bound() function (to
use an algorithm similar to Go's std lib). Using Go 1.12
nice speedup using https://github.com/MichaelTJones/pcg
<https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FMichaelTJones%2Fpcg&sa=D&sntz=1&usg=AFQjCNGPmR0DiOobBhs9QKIFJ5T92T6p1A>
## using stdlb math/rand (Go 1.11.5)
pkg: github.com/drgo/abm/rng
BenchmarkScalingFreqDis
Thanks everyone for helpful feedback,
What do people think about the approach explained here
http://iquilezles.org/www/articles/sfrand/sfrand.htm?
Any possible disadvantages in a Go implementation?
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
Thanks Ian,
The std lib float32 is slow for my purpose. In my benchmarking it is actually
slower than the float64. But I don’t even need float16 precision.
I am working on implementing othe alias method for sampling from a fixed freq
dist with possibly thousands of arbitrary values. So the rng do
what is the fastest possible algorithm to generate a float32 pseudo-random
number in [0.0,1.0)?
need to generate billions of numbers. Statistical performance and security
(and even space) are not a priority.
any Go implementations you know of?
Thanks,
--
You received this message because you a
what worked for me in a largish project is using an internal package (named
"types") to host types used in more than package.
On Thursday, February 21, 2019 at 3:30:08 PM UTC-6, Manlio Perillo wrote:
>
> Hi.
>
> I'm implementing a generic (and very simple) interface for key-value
> databases, a
wondering if anyone ran into this issue trying to build go1.11.1 or tip
*➜ **src* *git:(**26957168c4**) **✗* ./all.bash
Building Go cmd/dist using /usr/local/Cellar/go/1.11.1/libexec.
Building Go toolchain1 using /usr/local/Cellar/go/1.11.1/libexec.
go: warning: "bootstrap/cmd/..."
What I like about error handling in Go is that errors are just values. Like
any other values, they can be transparently stored, aggregated, passed
around and used, among other things, to explicitly change program flow.
That is why I am on the whole satisfied by Go 1's approach and a bit
concern
*Job Description :*
Computer Programmer - Information Technologist 4 (AESES) New Grant-Funded
Project Full-Time 35.00 hours/week Monday to Friday 8:30-4:30 Salary Range:
($65,538.20 - $87,669.40 per annum). For more information, please contact:
Andrea Toyne 753 McDermot Ave andrea.to...@umanit
, some are discussed here
https://github.com/golang/go/issues/17084
and here <https://www.baeldung.com/java-path>
On Monday, August 6, 2018 at 9:46:39 AM UTC-5, Marvin Renich wrote:
>
> * DrGo > [180806 02:00]:
> > Thanks,
> > filepath.Abs does some of what I want, but
rom path <https://golang.org/pkg/path/>. It handles such things based on
> OS & etc. Hope it helps
>
> On Monday, 6 August 2018 06:49:15 UTC+4:30, DrGo wrote:
>>
>> In many applications, I need to resolve an arbitrary file name that a
>> user provided to a valid file
In many applications, I need to resolve an arbitrary file name that a user
provided to a valid file-system path that can be used to open, create or
append to a file. I think I now have written 4 funcs to achieve one or
another of these objectives, but none that is flexible enough and robust
eno
Hello,
I have an app that uses Go's standard template package. The app reads an
xml file and passes the info to a template (snippet shown below) including
a slice of structs that the template can range over. eg
{{- range $source:= $grant.SubSection "Funding Sources" }}
Although the SubSection
Thanks for your informative report. I fully agree with you re the zero value of
maps. A read-only empty is useless.
--
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
Thanks Michael,
Here is the cleaner current version, thanks to your suggestion:
//writeData loops over the field vectors and write their binary
representation to an io.Writer
func (sf *File) writeData(w io.Writer) error {
if sf.NoObs == 0 {
return nil
}
if len(sf.fields) == 0
Michael,
here is the cleaner (thanks to your suggestion) current version:
//writeData loops over the field vectors and write their binary
representation to an io.Writer
func (sf *File) writeData(w io.Writer) error {
if sf.NoObs == 0 {
return nil
}
if len(sf.fields) == 0 {
Thanks Tamas,
I agree re float32bits. I think the compiler will inline it. Right?
Re binary.put*, I am essentially inlining their implementation and avoiding
unnecessary use of reflection for serializing the floats.
I am not sure I understand your point re the type switch, can you provide an
e
Thanks,
I agree re float32bits. I think the compiler will inline it. Right?
Re binary.put*, I am essentially inlining their implementation and avoiding
unnecessary use of reflection for serializing the floats.
I am not sure I understand your point re the type switch, can you provide an
example
Hello,
I am looking for help reviewing the function below. I need to generate
millions of large files in a specific binary format. I do not care about
portability (only used on Little Endian machines). The file format writes
the data in row order, so need to loop over slices of different types a
Hello,
The default behaviour of os.Create is to truncate the file if already
exists. I wrote the code below to control whether the file should be
overwritten or not (possibly based on user wishes). Seems to work on MacOS.
Do you think this code will work on Windows and Linux? Do you see any
subt
I needed to replace a specially coded tokens with their unicode
representations. strings.NewReplacer made it clean and easy.
first, you pass to strings.NewReplacer a string array literal made up of
old, new string pairs, like so
var logicalReplacer = strings.NewReplacer(
"%and", `∧`, //LOG
I needed to replace a specially coded tokens with their unicode
representations. strings.NewReplacer made it clean and easy.
first, you pass to strings.NewReplacer a string array literal made up of
old, new string pairs, like so
var logicalReplacer = strings.NewReplacer(
"%and", `∧`, //LOGICAL
Sorry if this was asked before, but I could not find any relevant posts.
Any reason why this struct literal (made up of fields that can be declared
const) is not allowed?
const UnknownPos = scanner.Position{"", -1, -1, -1}
error: const initializer scanner.Position literal is not a constant.
Cu
Thanks Nate,
--
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.
Hello,
The following compiles as well as evades scrutiny by go Vet (and many a
human reviewer) resulting in perplexing bugs. What purpose calling append()
with only one argument serves? Shouldn't it be banned?
```
var byteArray= []byte{'A', 'B',}
func main() {
buf:=[]byte {'C'}
buf = append(b
Very nice, 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/o
Given this declaration
type globalOptions struct {
...
ccv *ccvxml.CCV
funcMap template.FuncMap
}
Why this does not compile
//Initialize template functions
func newGlobalOptions() *globalOptions {
g := globalOptions{
ccv: ccvxml.New(),
funcM
Thanks Tim,
Very nice overview of the mechanics of a web app.
--
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 o
https://arxiv.org/pdf/1409.0252.pdf
A nice analysis showing that Go gets the balance of performance vs
robustness right. Some aspects of the analysis are naive, like measuring
productivity by numbers of lines. And this is using Go 1.3!!
--
You received this message because you are subscribed
Thanks Nick,
This looks promising!
--
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://group
Has any used Go to develop a cross-platform an easy-to-use utility to encrypt
individual files or folders?
--
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
Thanks Ian,
Very helpful
--
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.
What is the reason for Go particularly poor performance in regexdna as shown
here?
https://benchmarksgame.alioth.debian.org/u64q/performance.php?test=regexdna
Cheers
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group
Thanks Sam,
I managed without a token_peek(). It just leads to more verbose code with
calls to scan() and switches everywhere.
On Thursday, August 25, 2016 at 10:52:54 PM UTC+1, Sam Whited wrote:
>
> On Thu, Aug 25, 2016 at 2:09 PM, DrGo >
> wrote:
> > Ok! So my original
Ok! So my original post was not clear. Let us say you just executed scan()
twice on this string: a= x
As expected, Scan() returned scanner.Ident for a, followed by a rune indicating
the = sign.
Now, peek() will return 32 for the space whereas scan() returns scanner.Ident
for the identifier x. Pe
Hello,
Perhaps I am misunderstanding the purpose or do not know how to optimally
use this package, but the way I see it scanner.peek() is not doing what I
expect it to do: return the next non-whitespace token (e.g., scanner.Ident,
scanner.Int etc) without advancing the scanner. Instead it retur
Gophers in the news:
http://www.cbc.ca/shortdocs/shorts/world-famous-gopher
https://www.youtube.com/watch?v=QGT8XLrYnio
--
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 em
67 matches
Mail list logo