Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/douglascamata/gocopy
Copy types and functions from Go source across the internet!
https://github.com/douglascamata/gocopy
go golang
Last synced: 18 days ago
JSON representation
Copy types and functions from Go source across the internet!
- Host: GitHub
- URL: https://github.com/douglascamata/gocopy
- Owner: douglascamata
- License: mit
- Created: 2024-07-19T14:57:42.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-19T17:01:31.000Z (6 months ago)
- Last Synced: 2024-11-04T11:48:00.309Z (2 months ago)
- Topics: go, golang
- Language: Go
- Homepage:
- Size: 279 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gocopy
## What is it?
`gocopy` is a simple utility to copy functions and types from Go source files.
## Why?
Because sometimes I want to copy over some code from a file somewhere else.
It's easy to do the first copy & paste, but maintenance becomes a burden as
the source gets updated.So I've built this tool to be used with `go generate`.
## Examples
### Copying a type
To copy the `Decoder` type from the `encoding/json` package:
`gocopy type -u "https://golang.org/src/encoding/json/decode.go?m=text" -n Number`
If you want to include all its methods, use the `-m` flag (shorthand for `--methods`):
`gocopy type -u "https://golang.org/src/encoding/json/decode.go?m=text" -n Number -m`
### Copying a function
To copy the `Decode` function from the `encoding/json` package:
`gocopy function -u "https://golang.org/src/encoding/json/decode.go?m=text" -n Unmarshal`