Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc/code.html: update description of install command #24506

Closed
toni-rmc opened this issue Mar 23, 2018 · 8 comments
Closed

doc/code.html: update description of install command #24506

toni-rmc opened this issue Mar 23, 2018 · 8 comments
Labels
Documentation Issues describing a change to documentation. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@toni-rmc
Copy link

toni-rmc commented Mar 23, 2018

What version of Go are you using (go version)?

go version go1.10 windows/amd64

Does this issue reproduce with the latest release?

1.10 is the latest at this moment

What operating system and processor architecture are you using (go env)?

GOARCH=amd64
GOOS=windows

What did you do?

I have small test program with two small dummy libraries.

Go program in the src has path github.com/user/hello

package main

import (
    "fmt"

    // Libraries bellow are not automatically generated in pkg
    "github.com/user/stringutil"
    "github.com/user/tttt"
)

func main() {
    fmt.Printf(stringutil.Reverse("\nHello, world.\n"))
    fmt.Println(add(85,tttt.Tttt(9)))
}

add() function is in separate file, also in hello directory:

package main

func add(x int, y int) int {
    return x + y
}

When I don't have the above libraries compiled and just use go install hello program is installed and works but the pkg directory is not created and no stringutil.a and tttt.a.

If I want to have libraries generated I have to use go install on every library, in which case pkg is generated and libraries in it.

this is not behaviour according to this documentation:

Whenever the go tool installs a package or binary, it also installs whatever dependencies it has. So when you install the hello program
$ go install github.com/user/hello
the stringutil package will be installed as well, automatically.

Note that I have just installed the latest version (1.10) and just start using it as is writing only one dummy program and two dummy libraries one of which is copied from Go documentation.

What did you expect to see?

Dependencies installed automatically in the pkg

What did you see instead?

No pkg and no installed dependencies

@AlexRouSg
Copy link
Contributor

AlexRouSg commented Mar 23, 2018

The behavior has since been changed such that to install the dependencies you need to pass the -i flag.
https://golang.org/cmd/go/#hdr-Compile_and_install_packages_and_dependencies

The -i flag installs the dependencies of the named packages as well.

Do you have a link to where you got the documentation?

@toni-rmc
Copy link
Author

toni-rmc commented Mar 23, 2018

Got it from here
https://tour.golang.org/concurrency/11

Link to the documentation is on this page in the

To learn how to organize and work with Go code, watch this screencast or read How to Write Go Code.

section.

"How to Write Go Code" part is the link to it.

Direct link to docs:
https://golang.org/doc/code.html

@toni-rmc
Copy link
Author

With the -i flag works as it should.

@bcmills bcmills changed the title Go 1.10 does not automatically installs libraries doc/code.html: update description of install command Mar 23, 2018
@bcmills bcmills added the Documentation Issues describing a change to documentation. label Mar 23, 2018
@bcmills bcmills added this to the Unreleased milestone Mar 23, 2018
@bcmills bcmills added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 23, 2018
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/105655 mentions this issue: doc/code.html: updates description of go install

@ijxy
Copy link

ijxy commented Apr 8, 2018

Fixed in +105655 @bcmills

@toni-rmc
Copy link
Author

toni-rmc commented Apr 9, 2018

I'm still seeing install without -i switch in the web documentation linked above.

@AlexRouSg
Copy link
Contributor

@toni-rmc

Fix has not been approved and merged yet

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/129679 mentions this issue: doc/code: drop mentions of GOPATH/pkg directory

@golang golang locked and limited conversation to collaborators Aug 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation Issues describing a change to documentation. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

6 participants