An interesting idea. Some thoughts
On Friday, February 2, 2018 at 9:03:54 AM UTC-8, matthe...@gmail.com wrote:
>
> I’m looking at patterns summarized on Wikipedia from “Design Patterns:
> Elements of Reusable Object-Oriented Software” and writing out a few as the
> equivalent in Go.
>
> Visi
I have a different perspective
On Thursday, April 5, 2018 at 10:26:19 AM UTC-7, bingj...@gmail.com wrote:
>
> Almost 10 years golang appears in the world. 10 years is not a short
> duration. I think if it is not popular until 2020, it will never be popular.
>
> Golang is designed for cloud and in
Hi Anirudh,
On Tuesday, May 22, 2018 at 4:29:59 PM UTC-7, Anirudh Vyas wrote:
>
> Hi -
>
> I want to have a Printfln on log and fmt - Currently I use fmt.Printf( "
> yada yada \n", some_yada_yada) to achieve same effect. Is there a plan to
> add this simple yet extremely useful function?
>
I
Two thoughts about the contracts proposal:
- In the proposal a contract is loosely defined as the resulting
implications from a function. In the interests of starting a discussion, it
seems like a great starting place. However, it feels like it would be
useful to spell it out in the
On Monday, September 17, 2018 at 9:04:26 AM UTC-7, jucie@zanthus.com.br
wrote:
>
> Go core team is working hard to bring generics to the language because
> several people asked for it. With all due respect for those users and for
> people working hard to make generics a reality, I feel tha
On Tue, Sep 18, 2018 at 6:21 AM Robert Engels wrote:
> I am going to refer everyone involved in this discussion on generics to
> this once again. I know it is long, read the summary... but it’s important:
>
>
> https://www.researchgate.net/publication/236644412_Adoption_and_Use_of_Java_Generics
>
Is an alternate solution to use Go as a source language, then translate to
an allegedly "ISO" language?
Eric.
On Thursday, October 11, 2018 at 8:57:39 PM UTC-7, Beoran wrote:
>
> So no matter if I say yes or no, both ways are bad? I think is not a very
> fair way to argue.
>
> Anyway, with the
I always go with the approach that uses the equivalent of the "Transact()"
method.
On top of that, rather than use a generic *sql.Tx parameter to the "txFunc"
function, I pass an interface that is specific to the operations of the
database layer for my application.
This pattern has three benef
On Thu, Dec 6, 2018 at 12:16 AM roger peppe wrote:
>
>
> On Wed, 5 Dec 2018 at 18:55, 'Eric Johnson' via golang-nuts <
> golang-nuts@googlegroups.com> wrote:
>
>> I always go with the approach that uses the equivalent of the
>> "Transact()" me
n.
Eric.
> On Thu, 6 Dec 2018, 10:26 pm Eric Johnson
>>
>>
>> On Thu, Dec 6, 2018 at 12:16 AM roger peppe wrote:
>>
>>>
>>>
>>> On Wed, 5 Dec 2018 at 18:55, 'Eric Johnson' via golang-nuts <
>>> golang-nuts@googlegroups.com&
On Saturday, September 21, 2013 at 7:04:09 AM UTC-7, Michael Daconta wrote:
>
> As you can see, the code has semi-colons in each required location. So, I
> ask you - why is the above code illegal?
>
Why is breaking the speed limit illegal? On many roads, it is set
arbitrarily low because that
As I scan reports of vulnerable software, I'm concerned that it is
impossible to tell, from a Go binary, what was used to build that binary.
Which means that if I depend on some library that is discovered to have a
vulnerability, I cannot look at each of the binaries I have deployed, and
discov
tems.
Eric.
On Wed, Aug 16, 2017 at 9:10 AM, Lars Seipel wrote:
> On Tue, Aug 15, 2017 at 04:58:00PM -0700, 'Eric Johnson' via golang-nuts
> wrote:
> > As I scan reports of vulnerable software, I'm concerned that it is
> > impossible to tell, from a Go binary, wh
For the truly paranoid, perhaps write a helper function "EnsureClosed()" or
something like that, which will do the close, but perhaps also
appropriately log a failure to close.
On Wednesday, August 16, 2017 at 5:05:39 AM UTC-7, Gert wrote:
>
> To pass errcheck I need to do something like
>
> def
Gopkg.lock (if everyone uses dep) but not much else. They may be
> Debian and build from source packages where the Go compiler sees no version
> info at all - but the package manager knows the information you want. Etc.
>
> //jb
>
> On 16 Aug 2017, at 20:11, 'Eric Joh
One last bit of perspective here, which may be relevant to your project?
I've found that Go has the lowest cognitive load "switching" load. I have a
job that mostly doesn't involve coding. When I get to code, I have a
limited window in which I can jump in and make changes. Amongst the
languages
Anyone have any insight into whether it is possible to launch a Meltdown or
Spectre attack using Go code?
Go's general practice of preventing access beyond slice limits, and its
habit of zeroing memory makes me think triggering a Spectre or Meltdown
attack with Go code is very unlikely.
On the
I was looking at fixing an issue flagged by gometalinter, and realized I
didn't understand the actual behavior of defer statements. Specifically, I
was not handling the error return of a close operation.
I wrote a test program so I could understand the behavior, which led to
these two function
It would be great to hear of an answer to this question. I suspect there
isn't one, though.
The trouble is, one of the first hurdles is to identify Go libraries that
have CVEs against them. It is very easy to find CVEs for the Go standard
library, but I cannot see any easy way to scan the vulne
And then, it also occurs to me that perhaps I can answer my own question.
Taking advantage of three aspects of the ecosystem.
#1) Most open source Go libraries are on GitHub
#2) Many (most?) CVEs for open source projects will include a reference
back to the project, and these references can be e
Tips:
- When ever you're wondering about a good library for , two good
places to start are https://go-search.org ,
and https://github.com/avelino/awesome-go.
- As an alternative to finding a Go implementation, reuse an existing
one (libxslt) by calling out to C code. It may s
Not that I think these account for much, but sort of fun to point at:
https://benchmarksgame.alioth.debian.org/u64q/go.html
(Short summary - now with Go 1.7, Go is faster for most benchmarks.)
And then, for language adoption, the TIOBE language index for August of
2016:
http://www.tiobe.com/tiob
29, 2016 at 4:51 PM, 'Eric Johnson' via golang-nuts
> wrote:
> >
> > And then, for language adoption, the TIOBE language index for August of
> > 2016:
> > http://www.tiobe.com/tiobe-index/
> >
> > (Note that the above is updated every six mo
I looked at the k-nucleotide program, and was unable to figure out a way
to make it faster.
Most of the time appears to be spent on this one line:
pointer, ok := counts[key]
pprof reports:
19080ms 56.50% 56.50%22100ms 65.44% runtime.mapaccess2_fast64
This is, of course, exactly
On 8/31/16 2:04 AM, Harald Weidner wrote:
Hello,
On Tue, Aug 30, 2016 at 04:41:29PM -0700, 'Eric Johnson' via golang-nuts wrote:
I looked at the k-nucleotide program, and was unable to figure out a way to
make it faster.
This is, of course, exactly what the test is suppose to b
Why not, instead of passing a file path as a parameter, pass a function that
returns a ReadCloser (and error, of course). That way, you can preserve the
existing semantics of your function, but move the decision of what to open, how
to open, and how to handle the error for when it fails - all ou
On Thursday, September 29, 2016 at 1:12:41 AM UTC-7, dja...@gmail.com wrote:
>
> Hi,
> May be OT, but:
>
> Can i translate some GPLv2 licensed C code to GO, and publish it under
> BSD new license ?
> Code comments are from original C code.
>
The correct way to do this would be to perform a "cl
On Tuesday, October 11, 2016 at 5:55:23 AM UTC-7, Peter Vypov wrote:
>
> This question has been asked here a number of times, but the last time a
> few months ago: are there any plans to add support for package versioning
> (understanding VCS tags in the import paths), that is to teach `go get`
On 10/12/16 2:32 AM, Peter Vypov wrote:
On Wednesday, October 12, 2016 at 2:04:19 AM UTC+2, Eric Johnson wrote:
My view is that the general case requires putting such metadata in
a separate file for a package.
Yes, I agree with you that having multiple Go files with such comments
cr
On Friday, November 4, 2016 at 2:32:24 PM UTC-7, Tong Sun wrote:
>
> How to beautify a given XML string in GO?
>
As someone who has spent a fair amount of time in the complexities of XML,
it is worth noting that XML is not equivalent to JSON in the context of
your question.
Only with a schema
On Saturday, September 24, 2011 at 9:14:22 AM UTC-7, nvcnvn wrote:
>
> I just read here:
> http://golang.org/doc/go_faq.html#Is_Go_an_object-oriented_language
> And all of the GO example we have is not writen in OOP way.
> So can I say that GO see the benefit of Procedural over OO!?
>
Objec
On Monday, December 19, 2016 at 5:03:43 AM UTC-8, Tieson Molly wrote:
>
> What arguments or factors have contributed to your company adopting Go?
>
My company does enough different kinds of work that the question is too
broad. To some, "adoption" might imply broad usage. In practice, usage
evol
Stand-alone services are definitely the way to go. Pick a small service
that either is yet to be written, or is performing badly in its current
Java implementation.
Eric
On Dec 29, 2016, at 12:35 AM, Haddock wrote:
This thread is very interesting to me as I'm working exclusively with Java
and a
> On Jan 3, 2017, at 8:47 AM, Haddock wrote:
>
> I large organization where Java JEE architects are around bringing Go into
> the game is almost impossible. Many architects have build up their careers on
> application servers and EJBs without really understanding what that big big
> hammer is n
On Monday, July 18, 2016 at 4:45:37 AM UTC-7, rog wrote:
>
> On 16 July 2016 at 16:33, Daniel Theophanes > wrote:
> > I would also note that AGPL is probably unusable in most Go programs
> > (statically linked and all). -Daniel
>
> Why so? You just need to make your program open source, which
go-search.org and Google just found CVSS v2 implementations.
Anyone have any tips?
Eric.
--
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...
On Sunday, August 21, 2016 at 3:04:02 PM UTC-7, Asit Dhal wrote:
>
> Hi all,
> I use defer to release resource at function level.
>
> func test() {
> a := A.Open()
> defer a.Close()
> //other code
> }
>
> I need the object a, to be wrapped in a struct. Can someone tell me how to
> make a.C
On Tuesday, February 7, 2017 at 3:12:13 PM UTC-8, Francis Chuang wrote:
>
> I am working on a client library that starts a Kafka consumer to listen
> for messages from a kafka stream and run some user defined handlers.* I
> want the design to be "crash-only" as much as possible*, so will be
>
Structs give the caller so many immediate benefits:
- If there's internal state that clients shouldn't muck around with,
then (a) keep a field private, or (b) keep a field private and make it a
pointer to state (such as mutexes).
- Structs can be copied directly.
- Set and get don
My 2 cents:
On Saturday, April 1, 2017 at 4:26:20 AM UTC-7, Axel Wagner wrote:
>
> Ian:
> Re your question: See my example given above (or the one below, which is
> probably more authentic). For example, you might be allocating the returned
> struct, and piece by piece filling in the fields. If
A question has been bugging me for the past few weeks. How can I tell what
was used to build a Go application?
As I see various security notices scrolling by my email inbox, I see things
like Tomcat or OpenSSL announcing security updates, the JRE, or for that
matter, Go itself.
Once I see one
Just answered a question on Quora today that might be helpful:
https://www.quora.com/Why-would-anyone-program-in-Go/answer/Eric-Johnson-157?share=ca0e6b40&srid=zEgo
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group a
In this kind of scenario, I recommend a (type) wrapper for *File
Rework the code as:
type Doer *File
func NewDoer(f string) (Doer, err) {
file, err := os.Open(f)
// ...
}
func (d Doer) Close() error {
return d.Close()
}
Everything else being the same, your caller can then expect "Ne
Indeed. This is the same answer I was going to give.
Run-time code generation implies a whole bunch of different scenarios with
a whole bunch of use-cases. There are resource sharing concerns, security
concerns, and performance concerns that need to be nailed down. Otherwise
it is difficult to
Looks like iotest package provides tools to simulate various weird read
behaviors.
However, I want to simulate a failure, instead of just a slowdown or a
change in whether the EOF error is returned after the last full read.
Something like "ReadFailAfterN" which will trigger a non-EOF error afte
My take is something like the following would be more idiomatic
// SummonerByName returns profile address and an error. We need it in case
where
// we cannot get the profile for some reason
func SummonerByName(name string, server string) (*SummonerProfile, error) {
var resp, err = http.Get(fmt.S
On Sunday, July 9, 2017 at 9:12:06 PM UTC+2, Anmol Sethi wrote:
>
> Hello everyone!
>
> I’m writing a new library where I need to be able to configure a struct.
> This struct and its configuration will be accessed concurrently. One design
> pattern I see throughout the standard library and commu
While I lean towards the view that Go should add support for type generics,
I'm not sure your example actually provides sufficient detail to be an
argument for them.
On Monday, July 17, 2017 at 2:07:46 AM UTC-7, mhh...@gmail.com wrote:
>
> in func do(i interface{}) interface{} (return i), do say
Again, I'm mostly for generics being added to Go, because I've found
occasion where they would be useful...
On Thursday, July 20, 2017 at 6:40:00 AM UTC-7, M P r a d e s wrote:
>
> Go could have least have parametric functions (ex :
>
> func Foo(value T)T { /.../ }
>
> bar := Foo(3) //types are v
Indeed. The strength of Go's interfaces is precisely that a library
provider does not need to create interfaces, unless they are critical to
the implementation of the library. You should create these types of
interfaces when you need them.
There's a subtle versioning problem here. If Go adds a
On Sunday, January 26, 2020 at 10:27:35 PM UTC-8, pentel...@gmail.com wrote:
>
>
> IMHO, golang didn't make a dent on key areas to become a language of
> choice like big data (analytics, complex event processing, etc.) and
> consequently, hot topics like artificial intelligence. Exactly areas wh
To make an attempt at articulating why the error handling in Go is valuable
as-is, I note the following points:
- It is explicit, not hidden
- The default idiom highlights "error checking being done here" (Go
developers learn to look for lines "if err != nil".)
- It is possible to se
If I've got a structure like this:
type jsonData struct {
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
}
I can marshal / unmarshal JSON as:
{
"first_name": "first",
"last_name": "last"
}
What if my input JSON is this:
{
"first_name": "first",
"last_nam
lob into a plain interface{} value. The default concrete Go
> types are:
>
>- bool for JSON booleans,
>
>
>- float64 for JSON numbers,
>
>
>- string for JSON strings, and
>
>
>- nil for JSON null.
>
>
> Does this help?
>
> 'Eric
Thanks for the pointers.
I was hoping for an easier answer. Maybe will look into patching stdlib.
Eric.
On Sat, Feb 22, 2020 at 1:15 AM Brian Candler wrote:
> Looks like your thoughts are the right ones:
>
> https://stackoverflow.com/questions/33436730/unmarshal-json-with-some-known-and-some-
55 matches
Mail list logo