[
  {
    "path": ".editorconfig",
    "content": "\nroot = true\n\n[*]\ncharset = utf-8\nend_of_line = lf\ninsert_final_newline = true\ntrim_trailing_whitespace = true\nindent_style = space\nindent_size = 4\n\n[*.json]\nindent_size = 2\n"
  },
  {
    "path": ".eslintrc.js",
    "content": "module.exports = {\n    'env': {\n        'node': true,\n        'commonjs': true,\n        'es2021': true,\n        'mocha': true\n    },\n    'extends': 'eslint:recommended',\n    'parserOptions': {\n        'ecmaVersion': 13\n    },\n    'rules': {\n        'indent': [\n            'error',\n            4\n        ],\n        'linebreak-style': [\n            'error',\n            'unix'\n        ],\n        'quotes': [\n            'error',\n            'single'\n        ],\n        'semi': [\n            'error',\n            'always'\n        ]\n    }\n};\n"
  },
  {
    "path": ".gitattributes",
    "content": "* text eol=lf\n"
  },
  {
    "path": ".github/CONTRIBUTING.md",
    "content": "# Contribution Guidelines\n<!-- markdownlint-disable required-headers -->\n\n## Issues\n\nFound a bug? Got a question? Want some enhancement?<br>\nFirst place to go is the repository issues section, and I'll try to help as much as possible.\n\n## Pull Requests\n\nFixed a bug or just want to provided additional functionality?<br>\nSimply fork this repository, implement your changes and create a pull request.<br>\nFew guidelines regarding pull requests:\n\n* This repository is integrated with github actions for continuous integration.<br>\n\nYour pull request build must pass (the build will run automatically).<br>\nYou can run the following command locally to ensure the build will pass:\n\n````sh\nnpm test\n````\n\n* This library is using multiple code inspection tools to validate certain level of standards.<br>The configuration is part of the repository and you can set your favorite IDE using that configuration.<br>You can run the following command locally to ensure the code inspection passes:\n\n````sh\nnpm run lint\n````\n\n* There are many automatic unit tests as part of the library which provide full coverage of the functionality.<br>Any fix/enhancement must come with a set of tests to ensure it's working well.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug Report\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: sagiegurari\n\n---\n\n### Describe The Bug\n<!-- A clear and concise description of what the bug is. -->\n\n### To Reproduce\n<!-- Steps to reproduce the behavior: -->\n\n### Error Stack\n\n```console\nThe error stack trace\n```\n\n### Code Sample\n\n```js\n// paste code here\n```\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature Request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: ''\nassignees: sagiegurari\n\n---\n\n### Feature Description\n<!-- A clear description of the feature request. -->\n\n### Describe The Solution You'd Like\n<!-- A clear and concise description of what you want to happen. -->\n\n### Code Sample\n\n```js\n// paste code here\n```\n"
  },
  {
    "path": ".github/dependabot.yml",
    "content": "version: 2\nupdates:\n- package-ecosystem: npm\n  directory: \"/\"\n  schedule:\n    interval: daily\n    time: '03:00'\n  open-pull-requests-limit: 99\n"
  },
  {
    "path": ".github/workflows/ci.yml",
    "content": "name: CI\non: [push, pull_request]\nenv:\n  CLICOLOR_FORCE: 1\n  ACTIONS_ALLOW_UNSECURE_COMMANDS: true\njobs:\n  ci:\n    name: CI\n    runs-on: ubuntu-latest\n    strategy:\n      fail-fast: false\n      matrix:\n        node-version: ['12.x', '14.x']\n    steps:\n    - name: Set GOPATH\n      run: |\n          echo \"##[set-env name=GOPATH;]$(dirname $GITHUB_WORKSPACE)\"\n          echo \"##[add-path]$(dirname $GITHUB_WORKSPACE)/bin\"\n          echo \"##[add-path]$(dirname $GITHUB_WORKSPACE)/bin/windows_386\"\n      shell: bash\n    - name: Install Go\n      uses: actions/setup-go@v2\n      with:\n        go-version: 1.17.x\n    - name: Set GO Version\n      run: |\n          echo \"##[set-env name=GOPHERJS_GOROOT;]$(go env GOROOT)\"\n      shell: bash\n    - name: Install gopherjs\n      run: go get -u github.com/gopherjs/gopherjs\n    - name: Checkout\n      uses: actions/checkout@v2\n    - name: Install node.js\n      uses: actions/setup-node@v1\n      with:\n        node-version: ${{ matrix.node-version }}\n    - name: Install Dependencies\n      run: npm install\n    - name: Run CI\n      run: npm test\n    - name: Coveralls\n      uses: coverallsapp/github-action@master\n      with:\n        github-token: ${{ secrets.GITHUB_TOKEN }}\n        path-to-lcov: './coverage/lcov.info'\n"
  },
  {
    "path": ".github/workflows/codeql-analysis.yml",
    "content": "name: \"CodeQL\"\n\non:\n  push:\n  pull_request:\n  schedule:\n    - cron: '0 23 * * 5'\n\njobs:\n  analyse:\n    name: Analyse\n    runs-on: ubuntu-latest\n\n    steps:\n    - name: Checkout repository\n      uses: actions/checkout@v2\n      with:\n        # We must fetch at least the immediate parents so that if this is\n        # a pull request then we can checkout the head.\n        fetch-depth: 2\n\n    # If this run was triggered by a pull request event, then checkout\n    # the head of the pull request instead of the merge commit.\n    - run: git checkout HEAD^2\n      if: ${{ github.event_name == 'pull_request' }}\n\n    # Initializes the CodeQL tools for scanning.\n    - name: Initialize CodeQL\n      uses: github/codeql-action/init@v1\n      with:\n          languages: javascript\n      # Override language selection by uncommenting this and choosing your languages\n      # with:\n      #   languages: go, javascript, csharp, python, cpp, java\n\n    # Autobuild attempts to build any compiled languages  (C/C++, C#, or Java).\n    # If this step fails, then you should remove it and run the build manually (see below)\n    - name: Autobuild\n      uses: github/codeql-action/autobuild@v1\n\n    # ℹ️ Command-line programs to run using the OS shell.\n    # 📚 https://git.io/JvXDl\n\n    # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines\n    #    and modify them (or add more) to build your code if your project\n    #    uses a compiled language\n\n    #- run: |\n    #   make bootstrap\n    #   make release\n\n    - name: Perform CodeQL Analysis\n      uses: github/codeql-action/analyze@v1\n"
  },
  {
    "path": ".gitignore",
    "content": "target\n.temp\nnode_modules\nbower_components\nnpm-debug.log\npackage-lock.json\n.nyc_output\ncoverage\n"
  },
  {
    "path": ".jsbeautifyrc",
    "content": "{\n  \"js\": {\n    \"indent_size\": 4,\n    \"indent_char\": \" \",\n    \"eol\": \"\\n\",\n    \"indent_level\": 0,\n    \"indent_with_tabs\": false,\n    \"preserve_newlines\": true,\n    \"max_preserve_newlines\": 2,\n    \"space_in_paren\": false,\n    \"jslint_happy\": true,\n    \"space_after_anon_function\": true,\n    \"brace_style\": \"collapse\",\n    \"break_chained_methods\": false,\n    \"keep_array_indentation\": true,\n    \"unescape_strings\": false,\n    \"wrap_line_length\": 0,\n    \"end_with_newline\": true,\n    \"comma_first\": false,\n    \"eval_code\": false,\n    \"keep_function_indentation\": false,\n    \"space_before_conditional\": true,\n    \"good_stuff\": true\n  },\n  \"css\": {\n    \"indent_size\": 2,\n    \"indent_char\": \" \",\n    \"indent_with_tabs\": false,\n    \"eol\": \"\\n\",\n    \"end_with_newline\": true,\n    \"selector_separator_newline\": false,\n    \"newline_between_rules\": true\n  },\n  \"html\": {\n    \"indent_size\": 4,\n    \"indent_char\": \" \",\n    \"indent_with_tabs\": false,\n    \"eol\": \"\\n\",\n    \"end_with_newline\": true,\n    \"preserve_newlines\": true,\n    \"max_preserve_newlines\": 2,\n    \"indent_inner_html\": true,\n    \"brace_style\": \"collapse\",\n    \"indent_scripts\": \"normal\",\n    \"wrap_line_length\": 0,\n    \"wrap_attributes\": \"auto\",\n    \"wrap_attributes_indent_size\": 4\n  }\n}\n"
  },
  {
    "path": ".npmignore",
    "content": "target\n.temp\n.nyc_output\n.config\ncoverage\nbower_components\n.github\ntest\nexample\n"
  },
  {
    "path": ".stylelintrc.json",
    "content": "{\n  \"extends\": \"stylelint-config-standard\"\n}\n"
  },
  {
    "path": "LICENSE",
    "content": "Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright {yyyy} {name of copyright owner}\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n\n"
  },
  {
    "path": "README.md",
    "content": "# node-go-require\n\n[![NPM Version](http://img.shields.io/npm/v/node-go-require.svg?style=flat)](https://www.npmjs.org/package/node-go-require) [![CI](https://github.com/sagiegurari/node-go-require/workflows/CI/badge.svg?branch=master)](https://github.com/sagiegurari/node-go-require/actions) [![Coverage Status](https://coveralls.io/repos/sagiegurari/node-go-require/badge.svg)](https://coveralls.io/r/sagiegurari/node-go-require) [![Known Vulnerabilities](https://snyk.io/test/github/sagiegurari/node-go-require/badge.svg)](https://snyk.io/test/github/sagiegurari/node-go-require) [![Inline docs](http://inch-ci.org/github/sagiegurari/node-go-require.svg?branch=master)](http://inch-ci.org/github/sagiegurari/node-go-require) [![License](https://img.shields.io/npm/l/node-go-require.svg?style=flat)](https://github.com/sagiegurari/node-go-require/blob/master/LICENSE) [![Total Downloads](https://img.shields.io/npm/dt/node-go-require.svg?style=flat)](https://www.npmjs.org/package/node-go-require)\n\n> Load google go script as any javascript modules under nodeJS runtime.\n\n* [Overview](#overview)\n* [Usage](#usage)\n* [Installation](#installation)\n* [Limitations](#limitations)\n* [API Documentation](docs/api.md)\n* [Contributing](.github/CONTRIBUTING.md)\n* [Release History](#history)\n* [License](#license)\n\n<a name=\"overview\"></a>\n## Overview\nGo is an open source programming language that makes it easy to build simple, reliable, and efficient software.\n\nSee [golang.org](https://golang.org/) for more information.\n\n<a name=\"usage\"></a>\n## Usage\nIn order to use google go scripts under node, you need to first require this library as follows\n\n```js\nrequire('node-go-require');\n```\n\nNow you can require your google go files like any other javascript files, for example:\n\n```js\nvar petGo = require('./pet.go');\n\nvar pet = petGo.pet.New('my pet');\nconsole.log(pet.Name());\npet.SetName('new name...');\nconsole.log(pet.Name());\n```\n\nIn your go file, instead of doing module.exports as in any JS file, use the gopherjs solution for exporting objects/functions.\n\nDo not export to the global namespace, instead export to the module namespace.\n\nFor example:\n\n```go\njs.Module.Get(\"exports\").Set(\"pet\", map[string]interface{}{\n    \"New\": New,\n})\n```\n\nFull example (GO):\n\n```go\npackage main\n\nimport \"github.com/gopherjs/gopherjs/js\"\n\ntype Pet struct {\n  name string\n}\n\nfunc New(name string) *js.Object {\n  return js.MakeWrapper(&Pet{name})\n}\n\nfunc (p *Pet) Name() string {\n  return p.name\n}\n\nfunc (p *Pet) SetName(name string) {\n  p.name = name\n}\n\nfunc main() {\n  js.Module.Get(\"exports\").Set(\"pet\", map[string]interface{}{\n    \"New\": New,\n  })\n}\n```\n\nFull example (JavaScript):\n\n```js\nrequire('node-go-require');\n\nvar petGo = require('./pet.go');\n\nvar pet = petGo.pet.New('my pet');\nconsole.log(pet.Name());\npet.SetName('new name...');\nconsole.log(pet.Name());\n```\n\nIn order to generate minified javascript code, first set the following environment variable:\n\n```sh\nNODE_GO_REQUIRE_MINIFY=TRUE\n```\n\n<a name=\"installation\"></a>\n## Installation\nIn order to use this library, just run the following npm install command:\n\n```sh\nnpm install --save node-go-require\n```\n\nApart of installing the NPM modules, you will need to setup the following:\n\n* Install Google Go - [installation guide](https://golang.org/doc/install) (make sure that GOPATH env variable is defined)\n* Install gopherjs - [gopherjs](https://github.com/gopherjs/gopherjs) by running\n\n```sh\ngo get -u github.com/gopherjs/gopherjs\n```\n\n<a name=\"limitations\"></a>\n## Limitations\nThe Google Go to javascript conversion is done by gopherjs and there are some limitations of running the gopherjs generated code under node runtime.\n\nTo see exact limitations please see gopherjs project at: [gopherjs](https://github.com/gopherjs/gopherjs)\n\n## API Documentation\nSee full docs at: [API Docs](docs/api.md)\n\n## Contributing\nSee [contributing guide](.github/CONTRIBUTING.md)\n\n<a name=\"history\"></a>\n## Release History\n\n| Date        | Version | Description |\n| ----------- | ------- | ----------- |\n| 2020-05-13  | v2.0.0  | Migrate to github actions and upgrade minimal node version |\n| 2019-02-08  | v1.1.5  | Maintenance |\n| 2018-01-22  | v1.1.0  | Removed shelljs dependency and raised minimum node.js version to 0.12 |\n| 2017-02-07  | v1.0.25 | Ability to generate minified js code |\n| 2016-07-26  | v0.1.2  | Add integration test via docker |\n| 2015-02-14  | v0.0.16 | Modified tests and examples due to changes in gopherjs API |\n| 2015-02-09  | v0.0.15 | Grunt cleanups. |\n| 2015-02-06  | v0.0.14 | Doc changes |\n| 2015-02-05  | v0.0.13 | Fix continues integrations |\n| 2015-02-05  | v0.0.12 | Minor internal quality changes |\n| 2014-12-30  | v0.0.11 | Doc changes |\n| 2014-12-07  | v0.0.10 | Minor internal changes |\n| 2014-12-03  | v0.0.9  | No need to modify generated code |\n| 2014-12-03  | v0.0.8  | Simplified code generation modification |\n| 2014-12-02  | v0.0.7  | Mock gopherjs calls for continues integration tests. |\n| 2014-12-02  | v0.0.3  | Initial release. |\n\n<a name=\"license\"></a>\n## License\nDeveloped by Sagie Gur-Ari and licensed under the Apache 2 open source license.\n"
  },
  {
    "path": "docs/CHANGELOG.md",
    "content": "| Date        | Version | Description |\n| ----------- | ------- | ----------- |\n| 2020-05-13  | v2.0.0  | Migrate to github actions and upgrade minimal node version |\n| 2019-02-08  | v1.1.5  | Maintenance |\n| 2018-01-22  | v1.1.0  | Removed shelljs dependency and raised minimum node.js version to 0.12 |\n| 2017-02-07  | v1.0.25 | Ability to generate minified js code |\n| 2016-07-26  | v0.1.2  | Add integration test via docker |\n| 2015-02-14  | v0.0.16 | Modified tests and examples due to changes in gopherjs API |\n| 2015-02-09  | v0.0.15 | Grunt cleanups. |\n| 2015-02-06  | v0.0.14 | Doc changes |\n| 2015-02-05  | v0.0.13 | Fix continues integrations |\n| 2015-02-05  | v0.0.12 | Minor internal quality changes |\n| 2014-12-30  | v0.0.11 | Doc changes |\n| 2014-12-07  | v0.0.10 | Minor internal changes |\n| 2014-12-03  | v0.0.9  | No need to modify generated code |\n| 2014-12-03  | v0.0.8  | Simplified code generation modification |\n| 2014-12-02  | v0.0.7  | Mock gopherjs calls for continues integration tests. |\n| 2014-12-02  | v0.0.3  | Initial release. |\n"
  },
  {
    "path": "docs/api.md",
    "content": "## Classes\n\n<dl>\n<dt><a href=\"#GoLoader\">GoLoader</a></dt>\n<dd></dd>\n</dl>\n\n## Objects\n\n<dl>\n<dt><a href=\"#NodeGoRequire\">NodeGoRequire</a> : <code>object</code></dt>\n<dd><p>Extends the require capabilities to allow loading of google go\nscript files as JS files.</p>\n</dd>\n</dl>\n\n<a name=\"GoLoader\"></a>\n\n## GoLoader\n**Kind**: global class  \n**Access**: public  \n**Author**: Sagie Gur-Ari  \n\n* [GoLoader](#GoLoader)\n    * [new GoLoader()](#new_GoLoader_new)\n    * [#createGopherJSCommandArgs(goFile, [minify])](#GoLoader+createGopherJSCommandArgs) ⇒ <code>String</code>\n    * [#runGopherJS(goFile, gopherjs, [minify])](#GoLoader+runGopherJS) ⇒ <code>Object</code>\n    * [#runGoScript2JS(goFile, [options])](#GoLoader+runGoScript2JS) ⇒ <code>String</code>\n    * [#loadGoScript(goFile, goModule, [options])](#GoLoader+loadGoScript) ⇒ <code>Object</code>\n\n<a name=\"new_GoLoader_new\"></a>\n\n### new GoLoader()\nThe GoLoader enables to load google go script files and to load them into the\nnode runtime as JS files.\n\n<a name=\"GoLoader+createGopherJSCommandArgs\"></a>\n\n### GoLoader#createGopherJSCommandArgs(goFile, [minify]) ⇒ <code>String</code>\nReturns the gopher js command arguments.\n\n**Returns**: <code>String</code> - The command arguments  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| goFile | <code>String</code> |  | The google go script file path |\n| [minify] | <code>Boolean</code> | <code>false</code> | True to minify the generated code |\n\n<a name=\"GoLoader+runGopherJS\"></a>\n\n### GoLoader#runGopherJS(goFile, gopherjs, [minify]) ⇒ <code>Object</code>\nRuns the gopherjs converter process.\n\n**Returns**: <code>Object</code> - The process execution output (see shelljs for more information)  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| goFile | <code>String</code> |  | The google go script file path |\n| gopherjs | <code>String</code> |  | The gopherjs executable file location |\n| [minify] | <code>Boolean</code> | <code>false</code> | True to minify the generated code |\n\n<a name=\"GoLoader+runGoScript2JS\"></a>\n\n### GoLoader#runGoScript2JS(goFile, [options]) ⇒ <code>String</code>\nConverts the provided go file into JS script text.\n\n**Returns**: <code>String</code> - The JS string of the converted go script  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| goFile | <code>String</code> |  | The google go script file path |\n| [options] | <code>Object</code> |  | Optional runtime options |\n| [options.minify] | <code>Boolean</code> | <code>process.env.NODE_GO_REQUIRE_MINIFY</code> | True to minify the generated code |\n\n<a name=\"GoLoader+loadGoScript\"></a>\n\n### GoLoader#loadGoScript(goFile, goModule, [options]) ⇒ <code>Object</code>\nConverts the provided google go file into JS script and loads it into\nthe node runtime.\n\n**Returns**: <code>Object</code> - The JS module  \n**Access**: public  \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| goFile | <code>String</code> |  | The go script file path |\n| goModule | <code>Object</code> |  | The module for the go script |\n| [options] | <code>Object</code> |  | Optional runtime options |\n| [options.minify] | <code>Boolean</code> | <code>process.env.NODE_GO_REQUIRE_MINIFY</code> | True to minify the generated code |\n\n<a name=\"NodeGoRequire\"></a>\n\n## NodeGoRequire : <code>object</code>\nExtends the require capabilities to allow loading of google go\nscript files as JS files.\n\n**Kind**: global namespace  \n**Author**: Sagie Gur-Ari  \n**Example**  \nIn order to use google go scripts under node, you need to first require this library as follows\n```js\nrequire('node-go-require');\n```\nNow you can require your google go files like any other javascript files, for example:\n```js\nconst petGo = require('./pet.go');\n\nconst pet = petGo.pet.New('my pet');\nconsole.log(pet.Name());\npet.SetName('new name...');\nconsole.log(pet.Name());\n```\nGo source:\n```go\npackage main\n\nimport \"github.com/gopherjs/gopherjs/js\"\n\ntype Pet struct {\n   name string\n}\n\nfunc New(name string) *js.Object {\n   return js.MakeWrapper(&Pet{name})\n}\n\nfunc (p *Pet) Name() string {\n   return p.name\n}\n\nfunc (p *Pet) SetName(name string) {\n   p.name = name\n}\n\nfunc main() {\n   js.Module.Get(\"exports\").Set(\"pet\", map[string]interface{}{\n      \"New\": New,\n   })\n}\n```\n\n* [NodeGoRequire](#NodeGoRequire) : <code>object</code>\n    * [.goLoader](#NodeGoRequire.goLoader) : [<code>GoLoader</code>](#GoLoader)\n    * [.requireGo(goModule, fileName)](#NodeGoRequire.requireGo)\n\n<a name=\"NodeGoRequire.goLoader\"></a>\n\n### NodeGoRequire.goLoader : [<code>GoLoader</code>](#GoLoader)\nThe GO loader instance.\n\n**Access**: public  \n<a name=\"NodeGoRequire.requireGo\"></a>\n\n### NodeGoRequire.requireGo(goModule, fileName)\nThe node require implementation for google go scripts.\n\n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| goModule | <code>Object</code> | The module for the go script |\n| fileName | <code>String</code> | The go script file name |\n\n"
  },
  {
    "path": "inch.json",
    "content": "{\n  \"files\": {\n    \"included\": [\n      \"*.js\",\n      \"lib/**/*.js\",\n      \"tasks/**/*.js\"\n    ],\n    \"excluded\": [\n      \"**/Gruntfile.js\",\n      \"**/.eslintrc.js\",\n      \"**/stylelint.config.js\"\n    ]\n  }\n}\n"
  },
  {
    "path": "index.js",
    "content": "'use strict';\n\nmodule.exports = require('./lib/node-go-require');\n"
  },
  {
    "path": "lib/go-loader.js",
    "content": "'use strict';\n\nconst fs = require('fs');\nconst path = require('path');\nconst childProcess = require('child_process');\nconst vm = require('vm');\nconst extend = require('node.extend');\n\n/*jslint debug: true*/\n/*eslint-disable no-empty-function*/\n/**\n * The GoLoader enables to load google go script files and to load them into the\n * node runtime as JS files.\n *\n * @author Sagie Gur-Ari\n * @class GoLoader\n * @public\n */\nfunction GoLoader() {}\n/*eslint-enable no-empty-function*/\n/*jslint debug: false*/\n\n/**\n * Returns the gopher js command arguments.\n *\n * @function\n * @memberof! GoLoader\n * @public\n * @param {String} goFile - The google go script file path\n * @param {Boolean} [minify=false] - True to minify the generated code\n * @returns {String} The command arguments\n */\nGoLoader.prototype.createGopherJSCommandArgs = function (goFile, minify) {\n    const args = [\n        'build'\n    ];\n\n    if (minify) {\n        args.push('-m');\n    }\n\n    args.push(goFile);\n\n    return args;\n};\n\n/**\n * Runs the gopherjs converter process.\n *\n * @function\n * @memberof! GoLoader\n * @public\n * @param {String} goFile - The google go script file path\n * @param {String} gopherjs - The gopherjs executable file location\n * @param {Boolean} [minify=false] - True to minify the generated code\n * @returns {Object} The process execution output (see shelljs for more information)\n */\nGoLoader.prototype.runGopherJS = function (goFile, gopherjs, minify) {\n    const args = this.createGopherJSCommandArgs(goFile, minify);\n\n    /*eslint-disable no-sync*/\n    /*jslint stupid: true*/\n    return childProcess.spawnSync(gopherjs, args, {\n        windowsHide: true\n    });\n};\n/*jslint stupid: false*/\n/*eslint-enable no-sync*/\n\n/**\n * Converts the provided go file into JS script text.\n *\n * @function\n * @memberof! GoLoader\n * @public\n * @param {String} goFile - The google go script file path\n * @param {Object} [options] - Optional runtime options\n * @param {Boolean} [options.minify=process.env.NODE_GO_REQUIRE_MINIFY] - True to minify the generated code\n * @returns {String} The JS string of the converted go script\n */\nGoLoader.prototype.runGoScript2JS = function (goFile, options) {\n    options = options || {};\n    if (options.minify === undefined) {\n        options.minify = (String(process.env.NODE_GO_REQUIRE_MINIFY).toLowerCase() === 'true');\n    }\n\n    //get current working directory\n    const cwd = process.cwd();\n\n    /*jslint nomen: true*/\n    const tempPath = path.join(__dirname, '../.temp');\n    /*jslint nomen: false*/\n\n    //get output JS file\n    let jsFile = goFile.substring(0, goFile.length - 'go'.length) + 'js';\n    jsFile = path.basename(jsFile);\n    const jsPath = path.join(tempPath, jsFile);\n\n    /*eslint-disable no-sync*/\n    /*jslint stupid: true*/\n    //set to a temp folder\n    if (!fs.existsSync(tempPath)) {\n        fs.mkdirSync(tempPath);\n    } else if (fs.existsSync(jsPath)) {\n        fs.unlinkSync(jsPath);\n    }\n    process.chdir(tempPath);\n\n    let gopherjs = 'gopherjs';\n    /*istanbul ignore next*/\n    if (process.env.GOPATH) {\n        gopherjs = path.join(process.env.GOPATH, 'bin', gopherjs);\n    }\n    const output = this.runGopherJS(goFile, gopherjs, options.minify);\n\n    process.chdir(cwd);\n\n    if (output.status !== 0) {\n        throw new Error('Failed to convert Go file to JS\\n' + output.stdout + '\\n' + output.stderr);\n    }\n\n    //read JS file\n    return fs.readFileSync(jsPath, {\n        encoding: 'utf8'\n    });\n};\n/*jslint stupid: false*/\n/*eslint-enable no-sync*/\n\n/**\n * Converts the provided google go file into JS script and loads it into\n * the node runtime.\n *\n * @function\n * @memberof! GoLoader\n * @public\n * @param {String} goFile - The go script file path\n * @param {Object} goModule - The module for the go script\n * @param {Object} [options] - Optional runtime options\n * @param {Boolean} [options.minify=process.env.NODE_GO_REQUIRE_MINIFY] - True to minify the generated code\n * @returns {Object} The JS module\n */\nGoLoader.prototype.loadGoScript = function (goFile, goModule, options) {\n    const jsString = this.runGoScript2JS(goFile, options);\n\n    /*jslint nomen: true*/\n    const context = extend({}, global, {\n        root: global.root,\n        module: goModule,\n        require: goModule.require.bind(goModule),\n        exports: goModule.exports,\n        __filename: goFile + '.js',\n        __dirname: path.resolve(goFile, '..')\n    });\n    /*jslint nomen: false*/\n    context.global = context;\n\n    return vm.runInNewContext(jsString, context, {\n        filename: goFile + '.js'\n    });\n};\n\nconst goLoader = new GoLoader(); //singleton\n\nmodule.exports = goLoader;\n"
  },
  {
    "path": "lib/node-go-require.js",
    "content": "'use strict';\n\n/**\n * Extends the require capabilities to allow loading of google go\n * script files as JS files.\n *\n * @author Sagie Gur-Ari\n * @namespace NodeGoRequire\n * @example\n * In order to use google go scripts under node, you need to first require this library as follows\n * ```js\n * require('node-go-require');\n * ```\n * Now you can require your google go files like any other javascript files, for example:\n * ```js\n * const petGo = require('./pet.go');\n *\n * const pet = petGo.pet.New('my pet');\n * console.log(pet.Name());\n * pet.SetName('new name...');\n * console.log(pet.Name());\n * ```\n * Go source:\n * ```go\n * package main\n *\n * import \"github.com/gopherjs/gopherjs/js\"\n *\n * type Pet struct {\n *    name string\n * }\n *\n * func New(name string) *js.Object {\n *    return js.MakeWrapper(&Pet{name})\n * }\n *\n * func (p *Pet) Name() string {\n *    return p.name\n * }\n *\n * func (p *Pet) SetName(name string) {\n *    p.name = name\n * }\n *\n * func main() {\n *    js.Module.Get(\"exports\").Set(\"pet\", map[string]interface{}{\n *       \"New\": New,\n *    })\n * }\n * ```\n */\n\nconst goLoader = require('./go-loader');\n\n/**\n * The node require implementation for google go scripts.\n *\n * @function\n * @alias NodeGoRequire.requireGo\n * @memberof! NodeGoRequire\n * @public\n * @param {Object} goModule - The module for the go script\n * @param {String} fileName - The go script file name\n */\nconst requireGo = function (goModule, fileName) {\n    goLoader.loadGoScript(fileName, goModule);\n};\n\n//use go loader to return a JS module\nrequire.extensions['.go'] = requireGo;\n\nmodule.exports = {\n    requireGo,\n    /**\n     * The GO loader instance.\n     *\n     * @member {GoLoader}\n     * @alias NodeGoRequire.goLoader\n     * @memberof! NodeGoRequire\n     * @public\n     */\n    goLoader\n};\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"node-go-require\",\n  \"version\": \"2.0.0\",\n  \"description\": \"Load Google GO files as any javascript modules under nodeJS runtime.\",\n  \"author\": {\n    \"name\": \"Sagie Gur-Ari\",\n    \"email\": \"sagiegurari@gmail.com\"\n  },\n  \"license\": \"Apache-2.0\",\n  \"homepage\": \"http://github.com/sagiegurari/node-go-require\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"http://github.com/sagiegurari/node-go-require.git\"\n  },\n  \"bugs\": {\n    \"url\": \"http://github.com/sagiegurari/node-go-require/issues\"\n  },\n  \"keywords\": [\n    \"go\",\n    \"require\"\n  ],\n  \"main\": \"index.js\",\n  \"directories\": {\n    \"lib\": \"lib\",\n    \"test\": \"test/spec\"\n  },\n  \"scripts\": {\n    \"clean\": \"rm -Rf ./.nyc_output ./coverage\",\n    \"format\": \"js-beautify --config ./.jsbeautifyrc --file ./*.js ./lib/**/*.js ./test/**/*.js\",\n    \"lint-js\": \"eslint ./*.js ./lib/**/*.js ./test/**/*.js\",\n    \"lint-css\": \"stylelint --allow-empty-input ./docs/**/*.css\",\n    \"lint\": \"npm run lint-js && npm run lint-css\",\n    \"jstest\": \"mocha --exit ./test/spec/**/*.js\",\n    \"coverage\": \"nyc --reporter=html --reporter=text --reporter=lcovonly --check-coverage=true mocha --exit ./test/spec/**/*.js\",\n    \"docs\": \"jsdoc2md lib/**/*.js > ./docs/api.md\",\n    \"test\": \"npm run clean && npm run format && npm run lint && npm run docs && npm run coverage\",\n    \"postpublish\": \"git fetch && git pull\"\n  },\n  \"dependencies\": {\n    \"node.extend\": \"^2\"\n  },\n  \"devDependencies\": {\n    \"chai\": \"^4\",\n    \"eslint\": \"^8\",\n    \"js-beautify\": \"^1\",\n    \"jsdoc-to-markdown\": \"^8\",\n    \"mocha\": \"^10\",\n    \"nyc\": \"^15\",\n    \"rimraf\": \"^4\",\n    \"stylelint\": \"^13\",\n    \"stylelint-config-standard\": \"^22\"\n  }\n}\n"
  },
  {
    "path": "test/helpers/helper.js",
    "content": "'use strict';\n\nconst fs = require('fs');\nconst path = require('path');\nconst childProcess = require('child_process');\nconst chai = require('chai');\nconst assert = chai.assert;\n\nmodule.exports = {\n    modifyTestLoader() {\n        let gopherjs = 'gopherjs';\n        const isWin = (/^win/).test(process.platform);\n        if (isWin) {\n            gopherjs = `${gopherjs}.exe`;\n        }\n        if (process.env.GOPATH) {\n            const goPath = process.env.GOPATH || '';\n            gopherjs = path.join(goPath, 'bin', gopherjs);\n        } else {\n            process.env.GOPATH = '';\n        }\n\n        /*jslint stupid: true */\n        if ((!gopherjs) || (!fs.existsSync(gopherjs))) {\n            console.log('Running tests without GO/gopherjs installed.');\n\n            childProcess.spawnSync = function (cmd, args) {\n                assert.isTrue(cmd.indexOf('gopherjs') !== -1);\n                const goFile = args[args.length - 1];\n\n                if (goFile.indexOf('error.go') !== -1) {\n                    return {\n                        status: 1,\n                        stdio: 'mock error'\n                    };\n                }\n\n                /*jslint nomen: true */\n                let jsPath = path.join(__dirname, 'pet-helper.js');\n                /*jslint nomen: false */\n                let jsString = fs.readFileSync(jsPath, {\n                    encoding: 'utf8'\n                });\n\n                //get output JS file\n                const tempPath = '.';\n                let jsFile = goFile.substring(0, goFile.length - 'go'.length) + 'js';\n                jsFile = path.basename(jsFile);\n                jsPath = path.join(tempPath, jsFile);\n\n                if (args[1] === '-m') {\n                    jsString = jsString.split('\\n').join('');\n                }\n\n                fs.writeFileSync(jsPath, jsString, {\n                    encoding: 'utf8'\n                });\n\n                return {\n                    status: 0\n                };\n            };\n        }\n        /*jslint stupid: false */\n    }\n};\n"
  },
  {
    "path": "test/helpers/main/error.go",
    "content": "package main\n\nimport (\n    \"github.com/gopherjs/gopherjs/js\"\n)\n\ntype Pet struct {\n    name string\n}\n\nfunc (p *Pet) Name() string {\n    return p.name\n}\n\nfunc (p *Pet) SetName(newName string) {\n    p.name = newName\n}\n\nfunc New(name string) *Pet {\n    return &Pet{name}\n}\n\nfunc main() {\n    error error error....\n    js.Module.Get(\"exports\").Set(\"pet\", map[string]interface{}{\n        \"New\": New,\n    })\n}\n"
  },
  {
    "path": "test/helpers/main/main.go",
    "content": "package main\n\nimport \"github.com/gopherjs/gopherjs/js\"\n\ntype Pet struct {\n\tname string\n}\n\nfunc New(name string) *js.Object {\n\treturn js.MakeWrapper(&Pet{name})\n}\n\nfunc (p *Pet) Name() string {\n\treturn p.name\n}\n\nfunc (p *Pet) SetName(name string) {\n\tp.name = name\n}\n\nfunc main() {\n\tjs.Module.Get(\"exports\").Set(\"pet\", map[string]interface{}{\n\t\t\"New\": New,\n\t})\n}\n"
  },
  {
    "path": "test/helpers/main/pet.go",
    "content": "package main\n\nimport \"github.com/gopherjs/gopherjs/js\"\n\ntype Pet struct {\n\tname string\n}\n\nfunc New(name string) *js.Object {\n\treturn js.MakeWrapper(&Pet{name})\n}\n\nfunc (p *Pet) Name() string {\n\treturn p.name\n}\n\nfunc (p *Pet) SetName(name string) {\n\tp.name = name\n}\n\nfunc main() {\n\tjs.Module.Get(\"exports\").Set(\"pet\", map[string]interface{}{\n\t\t\"New\": New,\n\t})\n}\n"
  },
  {
    "path": "test/helpers/main/vertex.go",
    "content": "package main\n\nimport (\n\t\"github.com/gopherjs/gopherjs/js\"\n\t\"math\"\n)\n\ntype Vertex struct {\n\tX, Y float64\n}\n\nfunc (v *Vertex) Abs() float64 {\n\treturn math.Sqrt(v.X*v.X + v.Y*v.Y)\n}\n\nfunc New(x float64, y float64) *Vertex {\n\treturn &Vertex{x, y}\n}\n\nfunc NewJS(x float64, y float64) *js.Object {\n\treturn js.MakeWrapper(New(x, y))\n}\n\nfunc main() {\n\tjs.Module.Get(\"exports\").Set(\"vertex\", map[string]interface{}{\n\t\t\"New\": NewJS,\n\t})\n}\n"
  },
  {
    "path": "test/helpers/pet-helper.js",
    "content": "'use strict';\n\nfunction Pet(name) {\n    this.name = name;\n}\n\nPet.prototype.Name = function () {\n    return this.name;\n};\n\nPet.prototype.SetName = function (name) {\n    this.name = name;\n};\n\nmodule.exports = {\n    pet: {\n        New(name) {\n            return new Pet(name);\n        }\n    }\n};\n"
  },
  {
    "path": "test/helpers/pet.js",
    "content": "'use strict';\n\nrequire('../..');\n\nconst mainGo = require('./main/pet.go');\n\nconst pet = mainGo.pet.New('my pet');\n\nconsole.log(pet.Name());\n\npet.SetName('new name...');\n\nconsole.log(pet.Name());\n"
  },
  {
    "path": "test/helpers/vertex.js",
    "content": "'use strict';\n\nrequire('../..');\n\nconst jsModule = require('./main/vertex.go');\n\nconst vertex = jsModule.vertex.New(2, 6);\n\nconsole.log(vertex.Abs());\n"
  },
  {
    "path": "test/spec/go-loader-spec.js",
    "content": "'use strict';\n\n/*jslint stupid: true, nomen: true*/\n\nconst path = require('path');\nconst chai = require('chai');\nconst assert = chai.assert;\nconst rimraf = require('rimraf');\nconst goLoader = require('../../lib/go-loader');\n\nrequire('../helpers/helper').modifyTestLoader();\n\ndescribe('Go Loader', function () {\n    const tempPath = path.join(__dirname, '../../.temp');\n\n    rimraf.sync(tempPath);\n\n    describe('runGoScript2JS', function () {\n        it('simple', function () {\n            this.timeout(90000);\n\n            delete process.env.NODE_GO_REQUIRE_MINIFY;\n\n            const goFile = path.resolve(__dirname, '../helpers/main/main.go');\n            const js = goLoader.runGoScript2JS(goFile);\n\n            assert.isString(js);\n            assert.isTrue(js.length > 0);\n        });\n\n        it('minified', function () {\n            this.timeout(180000);\n\n            const goFile = path.resolve(__dirname, '../helpers/main/main.go');\n\n            process.env.NODE_GO_REQUIRE_MINIFY = 'FALSE';\n            const unminified = goLoader.runGoScript2JS(goFile);\n            assert.isString(unminified);\n            assert.isTrue(unminified.length > 0);\n\n            process.env.NODE_GO_REQUIRE_MINIFY = 'TRUE';\n            const minified = goLoader.runGoScript2JS(goFile);\n            assert.isString(minified);\n            assert.isTrue(minified.length > 0);\n\n            assert.isTrue(minified.length < unminified.length);\n        });\n\n        it('options', function () {\n            this.timeout(180000);\n\n            const goFile = path.resolve(__dirname, '../helpers/main/main.go');\n\n            process.env.NODE_GO_REQUIRE_MINIFY = 'FALSE';\n            const minified = goLoader.runGoScript2JS(goFile, {\n                minify: true //opposite of env\n            });\n            assert.isString(minified);\n            assert.isTrue(minified.length > 0);\n\n            process.env.NODE_GO_REQUIRE_MINIFY = 'TRUE';\n            const unminified = goLoader.runGoScript2JS(goFile, {\n                minify: false //opposite of env\n            });\n            assert.isString(unminified);\n            assert.isTrue(unminified.length > 0);\n\n            assert.isTrue(minified.length < unminified.length);\n        });\n\n        it('error', function () {\n            this.timeout(90000);\n\n            const goFile = path.resolve(__dirname, '../helpers/main/error.go');\n            try {\n                const js = goLoader.runGoScript2JS(goFile);\n                assert.notOk(js);\n            } catch (error) {\n                assert.isDefined(error);\n            }\n        });\n    });\n\n    describe('createGopherJSCommandArgs', function () {\n        it('no minify', function () {\n            const args = goLoader.createGopherJSCommandArgs('./test.go');\n\n            assert.deepEqual(args, [\n                'build',\n                './test.go'\n            ]);\n        });\n\n        it('minify false', function () {\n            const args = goLoader.createGopherJSCommandArgs('./test.go', false);\n\n            assert.deepEqual(args, [\n                'build',\n                './test.go'\n            ]);\n        });\n\n        it('minify true', function () {\n            const args = goLoader.createGopherJSCommandArgs('./test.go', true);\n\n            assert.deepEqual(args, [\n                'build',\n                '-m',\n                './test.go'\n            ]);\n        });\n    });\n});\n"
  },
  {
    "path": "test/spec/index-spec.js",
    "content": "'use strict';\n\nconst chai = require('chai');\nconst assert = chai.assert;\nrequire('../../');\n\ndescribe('Index', function () {\n    it('require setup', function () {\n        assert.isFunction(require.extensions['.go']);\n    });\n});\n"
  },
  {
    "path": "test/spec/node-go-require-spec.js",
    "content": "'use strict';\n\n/*jslint stupid: true, nomen: true*/\n\nconst path = require('path');\nconst chai = require('chai');\nconst assert = chai.assert;\nrequire('../../lib/node-go-require');\n\nrequire('../helpers/helper').modifyTestLoader();\n\ndescribe('Node Go', function () {\n    it('require setup', function () {\n        assert.isFunction(require.extensions['.go']);\n    });\n\n    it('require', function () {\n        this.timeout(90000);\n\n        const goFile = path.resolve(__dirname, '../helpers/main/main.go');\n        const jsModule = require(goFile);\n\n        const pet = jsModule.pet.New('my pet');\n        let output = pet.Name();\n        assert.equal('my pet', output);\n        pet.SetName('new name');\n        output = pet.Name();\n        assert.equal('new name', output);\n    });\n});\n"
  }
]