{"id":18513977,"url":"https://github.com/daddye/igo","last_synced_at":"2025-10-28T06:17:52.997Z","repository":{"id":15039068,"uuid":"17764972","full_name":"DAddYE/igo","owner":"DAddYE","description":"Intermediate GoLang source representation","archived":false,"fork":false,"pushed_at":"2014-04-03T17:04:40.000Z","size":910,"stargazers_count":139,"open_issues_count":5,"forks_count":6,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-24T00:42:00.170Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://play.igolang.io","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DAddYE.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-15T00:43:49.000Z","updated_at":"2024-09-18T09:19:28.000Z","dependencies_parsed_at":"2022-09-07T02:50:34.992Z","dependency_job_id":null,"html_url":"https://github.com/DAddYE/igo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAddYE%2Figo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAddYE%2Figo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAddYE%2Figo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAddYE%2Figo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DAddYE","download_url":"https://codeload.github.com/DAddYE/igo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247993594,"owners_count":21030043,"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","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":[],"created_at":"2024-11-06T15:41:36.063Z","updated_at":"2025-10-28T06:17:47.964Z","avatar_url":"https://github.com/DAddYE.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## iGo, Intermediate Golang\n\nThis project provides an intermediate source representation of `go` source files.\n\nMost of the code comes directly from the standard library of `pkg/go` however the core part, `parser`\nand `scanner` has been heavily modified, the *igo* `ast` instead is pretty much unchanged to allow\nan easily swap with the original one.\n\nThe __aim__ of this project is to provide an alternative `go fmt` which means the you will be able\nto write as you _like_ and then distribute in the standard __go way__ (`*.go formatted files`).\n\n**It's in beta stage**\n\n### How it works?\n\nYou can [TRY IT on play.igolang.io](http://play.igolang.io) or with the `cli`:\n\n```\nusage: igo [compile|parse|build] [flags] [path ...]\n  -comments=true: print comments\n  -dest=\"\": destination directory\n  -tabs=true: indent with tabs\n  -tabwidth=8: tab width\n$ igo parse # will convert any *.go file in *.igo\n$ igo compile # will convert *.igo source code in *.go\n```\n\nNote that `build` currently is not yet implemented.\n\n### Manually convert go code:\n\n```python\nimport\n\t\"bytes\"\n\t\"fmt\"\n\t\"github.com/DAddYE/igo/from_go\"\n\t\"go/parser\"\n\t\"go/token\"\n\t\"io/ioutil\"\n\t\"log\"\n\t\"testing\"\n\nfunc ExampleFromGo()\n  # Initialize the scanner.\n  fset := token.NewFileSet() # positions are relative to fset\n\n  const filename = \"../ast/ast.go\"\n\n  src, err := ioutil.ReadFile(filename)\n  if err != nil\n    log.Fatalf(\"%s\", err)\n\n\n  file, err := parser.ParseFile(fset, filename, src, parser.ParseComments)\n  if err != nil\n    fmt.Println(err)\n    return\n\n  # Print the function body into buffer buf.\n  # The file set is provided to the printer so that it knows\n  # about the original source formatting and can add additional\n  # line breaks where they were present in the source.\n  var buf bytes.Buffer\n  from_go.Fprint(\u0026buf, fset, file)\n\n  # Print the cleaned-up body text to stdout.\n  fmt.Println(\u0026buf)\n```\n\n### Manually convert iGo code:\n\n```python\nimport\n\t\"bytes\"\n\t\"fmt\"\n\t\"github.com/DAddYE/igo/parser\"\n\t\"github.com/DAddYE/igo/to_go\"\n\t\"github.com/DAddYE/igo/token\"\n\t\"io/ioutil\"\n\t\"log\"\n\t\"testing\"\n\nfunc ExampleToGo()\n\t# Initialize the scanner.\n\tfset := token.NewFileSet() # positions are relative to fset\n\n\tconst filename = \"../ast/ast.igo\"\n\n\tsrc, err := ioutil.ReadFile(filename)\n\tif err != nil\n\t\tlog.Fatalf(\"%s\", err)\n\n\tfile, err := parser.ParseFile(fset, filename, src, parser.ParseComments)\n\tif err != nil\n\t\tfmt.Println(err)\n\t\treturn\n\n\t# Print the function body into buffer buf.\n\t# The file set is provided to the printer so that it knows\n\t# about the original source formatting and can add additional\n\t# line breaks where they were present in the source.\n\tvar buf bytes.Buffer\n\tto_go.Fprint(\u0026buf, fset, file)\n\n\t# Print the cleaned-up body text to stdout.\n\tfmt.Println(\u0026buf)\n```\n\n### How looks like?\n\nJust browse `*.igo` files, but soon I'll make a `ebnf` notation.\n\n### What will change?\n\nPretty much really few things, `golang` itself is almost perfect, this parser will allow you to skip\nsome annoyance. Nothing more.\n\n### Editors\n\n- [Vim](https://github.com/DAddYE/igo.vim)\n- add yours ...\n\n### What's left?\n\nIn my roadmap there is:\n\n- [x] Builds (aka `igo build|run|test`)\n- [ ] Add GoCode like for editors\n- [ ] iGo format (aka `igo fmt`)\n- [ ] iGo doc (aka `igo doc`)\n- [ ] Expose `ast` (aka `little macros`)\n- [ ] Expose `__filename__`, `__fname__`\n\n### Other info\n\nThis project was partially influenced by [Nimrod](http://nimrod-lang.org) which I highly\nsuggest to [try](http://nimrod-lang.org).\n\n### License MIT/BSD-style\n\nAuthor Davide D'Agostino (@DAddYE) and `The Go Authors`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaddye%2Figo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaddye%2Figo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaddye%2Figo/lists"}