{"id":34905140,"url":"https://github.com/alistanis/st","last_synced_at":"2025-12-26T10:00:04.506Z","repository":{"id":57516916,"uuid":"49977033","full_name":"alistanis/st","owner":"alistanis","description":"ST - Struct Tagger - Tags your structs so you don't have to, saving you development time and encoding/decoding sanity.","archived":false,"fork":false,"pushed_at":"2017-02-26T00:00:52.000Z","size":1798,"stargazers_count":85,"open_issues_count":4,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-08-15T10:44:42.697Z","etag":null,"topics":["developer-tools","go","golang","struct-tagger"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alistanis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-19T19:23:28.000Z","updated_at":"2023-02-21T16:58:59.000Z","dependencies_parsed_at":"2022-09-15T21:22:38.917Z","dependency_job_id":null,"html_url":"https://github.com/alistanis/st","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/alistanis/st","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alistanis%2Fst","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alistanis%2Fst/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alistanis%2Fst/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alistanis%2Fst/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alistanis","download_url":"https://codeload.github.com/alistanis/st/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alistanis%2Fst/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28052416,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-26T02:00:06.189Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["developer-tools","go","golang","struct-tagger"],"created_at":"2025-12-26T10:00:02.188Z","updated_at":"2025-12-26T10:00:04.495Z","avatar_url":"https://github.com/alistanis.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"ST - Struct Tagger for Go\n---\nst is a command line utility for tagging structs in your Go code.\n\n[![Build Status](https://travis-ci.org/alistanis/st.svg?branch=master)](https://travis-ci.org/alistanis/st) [![Gitter](https://badges.gitter.im/alistanis/st.svg)](https://gitter.im/alistanis/st?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)\n---\n\nGet it: \n```go get github.com/alistanis/st```\n\nIf you want to run the tests, you'll need the goconvey package:\n```go get github.com/smartystreets/goconvey```\n\nRoadmap\n---\n```\n1. [-] Command Line Support\n\t* [x] Write tags to buffer(default behavior) and to file (with -w)\n\t* [x] Supports multiple operation modes\n\t\t* [x] Append\n\t\t* [x] Overwrite\n\t\t* [x] Skip existing tags\n\t\t* [x] Field Exclusion\n\t\t* [x] Struct Exclusion\n\t\t* [ ] Explicit Struct/field inclusion\n\t\t* [ ] Go Generate support\n\t  [ ] Fix whatever is wrong with the windows version\n2. [ ] Web Application\n\t* [x] Basic static site handler (not in master)\n\t* [ ] Side by side input/output\n\t* [ ] Make it pretty  \n3. [x] Tests/Build/Deploy\n\t* [x] Main Package tests\n\t* [x] Parse Package tests\n\t* [x] Flags package tests\n\t* [x] Travis Integration\n\t\t* [x] Run tests automatically \n\t\t* [x] Build notifications\n4. [x] Miscellaneous\n\t* [x] Gitter Integration\n\t* [x] Slack Channel\n```\n\nUsage\n---\n\u003e```st -h or st --help```\n\n```\nusage: st [flags] [path ...]\n  -a\tSets mode to Append mode. Will Append to existing tags. Default behavior skips existing tags.\n  -Append\n    \tSets mode to Append mode. Will Append to existing tags. Default behavior skips existing tags.\n  -c\tSets the struct tag to camel case.\n  -camel\n    \tSets the struct tag to camel case\n  -i string\n    \tA comma separated list of fields to ignore. Will use the format json:\"-\".\n  -ignored-fields string\n    \tA comma separated list of fields to ignore. Will use the format json:\"-\".\n  -ignored-structs string\n    \tA comma separated list of structs to ignore. Will not tag any fields in the struct.\n  -is string\n    \tA comma separated list of structs to ignore. Will not tag any fields in the struct.\n  -o\tSets mode to overwrite mode. Will overwrite existing tags (completely). Default behavior skips existing tags.\n  -overwrite\n    \tSets mode to overwrite mode. Will overwrite existing tags (completely). Default behavior skips existing tags.\n  -s\tSets the struct tag to snake case.\n  -snake\n    \tSets the struct tag to snake case.\n  -t string\n    \tThe struct tag to use when tagging. Example: -t=json  (default \"json\")\n  -tag-name string\n    \tThe struct tag to use when tagging. Example: --tag-name=json  (default \"json\")\n  -v\tSets mode to verbose.\n  -verbose\n    \tSets mode to verbose.\n  -w\tSets mode to write to source file. The default is a dry run that prints the results to stdout.\n  -write\n    \tSets mode to write to source file. The default is a dry run that prints the results to stdout.\n```\n\nDefaults\n---\n\u003e\n* ST will not write to your source file unless you provide the **-w** or **-write** flags. Its default behavior prints the result to *STDOUT*\n* The default tag that ST uses is **json**\n* The default tagging mode is to *Skip Existing Tags* - you can change this behavior by providing one of the *Append* flags, **-a** or **-Append**, or by using one of the *Overwrite* flags, **-o** or **-overwrite**\n* The default tagging case is *Snake Case* - this can be changed by providing either *Camel Case* flag, **-c** or **-camel**  \n\u003e\n\u003eOverwrite mode will completely overwrite an existing tag. Append mode is a little trickier. If an existing tag is there for the\ntag that you have specified, let's use json as our example, it will leave that tag alone. If you specify a different tag, like msgpack,\nit will Append to the existing tag with the msgpack key/value.\n\nOverwrite Examples \n---\n\u003e```st --overwrite --tag-name=msgpack $GOFILE```\n\n```go\ntype Test struct { F field `json:\"f\"`}\n    becomes\ntype Test struct { F field `msgpack:\"f\"`}\n```\n\u003e```st --overwrite --tag-name=json --case=camel $GOFILE```\n\n```go\ntype Test struct { F field `json:\"f\"`}\n    becomes\ntype Test struct { F field `json:\"F\"`}\n```\n\nAppend Examples\n---\n\u003e```st --Append --case=camel --tag-name=json $GOFILE```\n\n```go\ntype Test struct { F field `json:\"f\"`}\n    becomes (the tag is left alone because it is already there)\ntype Test struct { F field `json:\"f\"`}\n```\n\u003e```st --Append --tag-name=msgpack $GOFILE```\n\n```go\ntype Test struct { F field `json:\"f\"`}\n    becomes\ntype Test struct { F field `msgpack:\"f\" json:\"f\"`}\n```\n\nContributing \u0026 Contact\n---\nIf you would like to contribute, don't be shy! Fork the project, write tests for any new code and ensure that you don't break existing\nfunctionality by running the current tests. If you're looking to submit changes upstream, it would be a good idea to\ndiscuss it with me first. I'm available via [email](ccooper@sessionm.com), through Github, on the\n[Gophers Slack ST Channel](https://blog.gopheracademy.com/gophers-slack-community/), or on [Gitter.im](https://gitter.im/alistanis/st).\n\nIf you do submit a pull request, I will review it and I will merge it if it's in line with my vision for the project.\n\n\nFurther examples\n---\n\n\u003eContents of etc.go before running any of the following\n\n```go\npackage etc\n\ntype TestStruct struct {\n\tInt             int\n\tInt64           int64\n\tIntSlice        []int\n\t...\n}\n\ntype TestStructWithTagsSnake struct {\n\tInt             int               `json:\"int\"`\n\tInt64           int64             `json:\"int_64\"`\n\tIntSlice        []int             `json:\"int_slice\"`\n\t...\n}\n\ntype TestStructWithTagsCamel struct {\n\tInt             int               `json:\"Int\"`\n\tInt64           int64             `json:\"Int64\"`\n\t...\n}\n\ntype TestUnexportedField struct {\n\tunexportedField int\n\tExportedField   int\n}\n\n```\n\n\u003e Append to existing tags with the tag msgpack (use -w flag to write to original source file) \n```\nst -s -a -v -t=msgpack $GOPATH/src/github.com/alistanis/st/etc/etc.go\n```\n\n```go \npackage etc\n\ntype TestStruct struct {\n\tInt             int               `msgpack:\"int\"`\n\tInt64           int64             `msgpack:\"int_64\"`\n\tIntSlice        []int             `msgpack:\"int_slice\"`\n\t...\n}\n\ntype TestStructWithTagsSnake struct {\n\tInt             int               `msgpack:\"int\" json:\"int\"`\n\tInt64           int64             `msgpack:\"int_64\" json:\"int_64\"`\n\tIntSlice        []int             `msgpack:\"int_slice\" json:\"int_slice\"`\n\t...\n}\n\ntype TestStructWithTagsCamel struct {\n\tInt             int               `msgpack:\"int\" json:\"Int\"`\n\tInt64           int64             `msgpack:\"int_64\" json:\"Int64\"`\n\tIntSlice        []int             `msgpack:\"int_slice\" json:\"IntSlice\"`\n\t...\n}\n\ntype TestUnexportedField struct {\n\tunexportedField int\n\tExportedField   int `msgpack:\"exported_field\"`\n}\n```\n\u003eIgnore a specific field (-i) and ignore a specific struct (-is)\n```\nst -s -a -v -i=ExportedField -is=TestStructWithTagsCamel -t=msgpack $GOPATH/src/github.com/alistanis/st/etc/etc.go\n```\n\n```go\npackage etc\n\ntype TestStruct struct {\n\tInt             int               `msgpack:\"int\"`\n\tInt64           int64             `msgpack:\"int_64\"`\n\tIntSlice        []int             `msgpack:\"int_slice\"`\n\t...\n}\n\ntype TestStructWithTagsSnake struct {\n\tInt             int               `msgpack:\"int\" json:\"int\"`\n\tInt64           int64             `msgpack:\"int_64\" json:\"int_64\"`\n\tIntSlice        []int             `msgpack:\"int_slice\" json:\"int_slice\"`\n\t...\n}\n\ntype TestStructWithTagsCamel struct {\n\tInt             int               `json:\"Int\"`\n\tInt64           int64             `json:\"Int64\"`\n\tIntSlice        []int             `json:\"IntSlice\"`\n\t...\n}\n\ntype TestUnexportedField struct {\n\tunexportedField int\n\tExportedField   int `msgpack:\"-\"`\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falistanis%2Fst","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falistanis%2Fst","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falistanis%2Fst/lists"}