Question

I want to basically copy the parse and template packages from the golang source: http://golang.org/pkg/text/

I want to be able to just play around wit the code and hack on it for fun and learning etc.

Can someone tell me how to go about doing this?

Could I just copy the package folders and then somehow move it to my own package like:

$GOPATH/src/github/user/parse
$GOPATH/src/github/user/template

Is this a safe way to do this? How will it build?

Was it helpful?

Solution

Yes, you can just copy the folder like you've described.

When you import it in your application, you just use your new import path:

import (
    "github.com/user/parse"
    "github.com/user/template"
)

It is completely safe to do that. Just Go ahead and code!

Ps.

I assumed your path would actually be:

$GOPATH/src/github.com/user/parse

since the domain (.com) will also be included in the go get path if you use github to host your package.

Ps2.

Remember to update the imports in the github.com/user/template package to refer to your new parse package instead of the original one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top