If you want gofmt to preserve ASCII art, just indent it.
https://play.golang.org/p/2ulwl8orRlG
On Fri, Apr 20, 2018 at 3:47 PM, Louki Sumirniy <
louki.sumirniy.stal...@gmail.com> wrote:
> If your variable and function names don't explain what is going on, you
> will encounter a big maintenance
If your variable and function names don't explain what is going on, you
will encounter a big maintenance problem with your code as non-updated
comments contradict your unreadable code.
Very occasionally I find a use for attention-grabbing comments, number one
for this, and personally I
BTW I was wrong about multiple go-paths. During implementation, I've learnt
lots of import path overwriting must take place to handle nested
dependencies of different versions, properly.
Well then, waiting for vgo.
--
You received this message because you are subscribed to the Google Groups
You should have a look at http://go-colly.org . I've done scraping with
html.Parse before, and I wish Colly existed when I did.
--
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,
gofmt and godoc remove choices that are fun, artistic, or tempting, but
distracting. I think you'll be best served by Go without the box.
Matt
On Thursday, April 19, 2018 at 6:42:40 PM UTC-5, Chris FractalBach wrote:
>
> Test #1
> Source:
> /*
> +--+
> |
Test #1
Source:
/*
+--+
| fancy box |
+--+
package goexplore explores Go!
*/
package goexplore
Result:
I would like to have a tool for testing infrastructure components. I
stumbled across Ginkgo. Does anyone use it? Does it need a go compiler for
tests? My intention is to write simple tests, "Is server up?". "Does the
file contain abc". But I don't want to have the go compiler installed to
run
You are right. That is very similar except that, instead of having a
convention for naming directories, there should exist a .goenv in the
working directory (or a up parent). In this .goenv file a go-path can be
set - and maybe other go env vars.
This way, it is possible to take advantage of
Thanks a lot!!!
On Thursday, April 19, 2018 at 11:55:49 AM UTC-7, Bakul Shah wrote:
>
> Terminate Scanf format strings with \n. To see why, do "go doc fmt.Scanf".
> Always check the result of (at least) any input operation such as Scanf.
>
> On Apr 19, 2018, at 10:31 AM, Alex Dvoretskiy
Terminate Scanf format strings with \n. To see why, do "go doc fmt.Scanf".
Always check the result of (at least) any input operation such as Scanf.
> On Apr 19, 2018, at 10:31 AM, Alex Dvoretskiy wrote:
>
> Hello Golang-nuts,
>
> Following code reads data from file
Added files. Semicolon made no difference. Still wrong result on win32.
On Thursday, April 19, 2018 at 10:45:35 AM UTC-7, Louki Sumirniy wrote:
>
> You need to show the input file also. I can only guess this has something
> to do with maybe cr/lf? What happens if you add a distinct separator to
You need to show the input file also. I can only guess this has something
to do with maybe cr/lf? What happens if you add a distinct separator to the
input such as a semicolon?
On Thursday, 19 April 2018 20:31:56 UTC+3, Alex Dvoretskiy wrote:
>
> Hello Golang-nuts,
>
> Following code reads data
Hello Golang-nuts,
Following code reads data from file and creates binary tree structure:
'
// go run main.go < input
package main
import "fmt"
type TreeNode struct {
Value int
Left *TreeNode
Right *TreeNode
}
func main () {
nodes := read()
for i, node := range(nodes) {
fmt.Printf("%p\n",
Yes, to use the functions above you will need to copy the slices of
landSpaceto slices of the respective interface types. But I you do not need
to do any type assertions. Like this:
https://play.golang.org/p/eFTUqpImyPc
package main
import (
"fmt"
)
type landSpace struct{}
func
Actually I have almost the same scenario: I am trying to upload large files
as a stream. Do you think the io.Copy() method would work for me? If not
what do you recommend.
On Friday, 27 November 2015 04:15:16 UTC+2, suman jakkula wrote:
>
> Is there any example of uploading a file to Rest API
Multiple return values. They do kinda exist in a declarative form of sorts,
in the type signature, this sets the number and sequence and types of
return values. You could even make functions accept them as also input
values, I think, but I don't think it works exactly like this. I'm not a
fan
Though the above is not allowed, you can restructure your code to wrap your
struct as array in another struct and have area() paas a index to the
underlying struct. Something like this (landSpaceArr wraps landSpace
struct) -
type landSpace struct{
side int
}
type landSpaceArr struct
When you have such questions, then run your code with the race
detector. https://golang.org/doc/articles/race_detector.html
Otherwise, you are only reading from the slice, there is no racing possible.
Also, your max function looks very weird and has a small bug:
i am trying html Parse method from "html"* package but can't find element
"img" ...*
*Any ideas?*
var f func(*html.Node)
f = func(n *html.Node) {
if n.Type == html.ElementNode { //&& n.Data == "alt" {
for _, a := range n.Attr {
//if a.Key == "img" {
On Thu, Apr 19, 2018 at 2:51 PM Louki Sumirniy <
louki.sumirniy.stal...@gmail.com> wrote:
> Sorry for the self-promotion but it was relevant in that I was working on
how to tidy up the readability of my code and needed multiple returns and
simple untyped tuples were really not nearly as
I think you're getting at something similar to:
https://docs.google.com/document/d/1Ee8POHVeo3N6c1pgiubdWoUJoYkD5cwY3p8rqonRY0o/edit
Implemented roughly here:
https://github.com/myitcv/go
This was itself similar to/influenced by:
I would start by isolating the alt=“…” string with splits
(https://golang.org/pkg/strings/#Split) then use Sscanf
(https://golang.org/pkg/fmt/#Sscanf) to parse the number. There may be
other approaches like regular expressions.
Matt
On Wednesday, April 18, 2018 at 9:52:28 PM UTC-5, l vic
Just to clarify. Yes, the parent/child relationships are purely based on
the indices of the nodes. It's not a conventional vector reference based
binary tree. I was surprised when I came up with the idea that such did not
even exist. Just to explain, it's a non-rectilinear array mapping. There
How does *go get -tags* work?
--
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
Is it possible to tell go tools to get the go-path from a source other than
$GOPATH?
Notes:
Assuming the answer is no, I wish it was possible.
For example when running a go command from the current directory, it go
search the current directory, or goes up, until it finds a (for example)
Ok, it may look like it but I don't want to track the cursor in the
datatype itself most especially for reasons being that even one of the
'sideways walk' functions in the library needs to keep a copy of the
coordinate of the previous node iterated past in order to identify when the
direction
On Thu, Apr 19, 2018 at 2:29 PM Kaveh Shahbazian
wrote:
> How does go get -tags work?
`go get -tags foo example.com/bar` should be similar, but not always equal
to `go get -d example.com/bar && go install -tags foo example.com/bar`.
--
-j
--
You received this
I have a program that calculates max value in integer array by breaking the
array into number of slices and calculating max in every slice inside of
go-routine.
Do I still need to lock/unlock each slice with mutex inside of go-routine?
The code seems to be working but are any apparent problems
I've figured that out
Turns out it's path is starts with vendor, not internal
(gdb) info functions
to show internal package file path
File
/root/godev/src/vendor/golang_org/x/crypto/chacha20poly1305/internal/chacha20/chacha_arm64.s:
void
Try putting a blank line between your comment block and the next symbol. This
will break the association between the comment block and the symbol and hide
the former.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this
On Thu, Apr 19, 2018 at 7:37 AM Chris FractalBach
wrote:
> However, adding comments like this into Go code often ruins the
documentation, so I have been avoiding it.
Please specify what do you mean by "ruins the documentation". Do you have
an example that can be already
On Wed, Apr 18, 2018 at 10:37:26PM -0700, Chris FractalBach wrote:
> So, I'm one of those people who sometimes adds comments like this to my
> code:
>
> ++
> | Program Title|
> | Author |
> |
Much appreciated for all the great advises from everyone.
Or to be more precise: it is crucial you load wait before notify and the
> check for equality can only happen if the routine "caught up". Also, your
> proof must hold if you remove the fast-path check in line 522.
>
Why is it crucial to
33 matches
Mail list logo