pax_global_header00006660000000000000000000000064133562442050014516gustar00rootroot0000000000000052 comment=989e774b106e1ba64cb2cb9de131e628bb27670b namegenerator-0.0.2/000077500000000000000000000000001335624420500143445ustar00rootroot00000000000000namegenerator-0.0.2/.circleci/000077500000000000000000000000001335624420500161775ustar00rootroot00000000000000namegenerator-0.0.2/.circleci/config.yml000066400000000000000000000050261335624420500201720ustar00rootroot00000000000000# Golang CircleCI 2.0 configuration file # # Check https://circleci.com/docs/2.0/language-go/ for more details version: 2 jobs: build: docker: # specify the version - image: circleci/golang:latest # Specify service dependencies here if necessary # CircleCI maintains a library of pre-built images # documented at https://circleci.com/docs/2.0/circleci-images/ # - image: circleci/postgres:9.4 #### TEMPLATE_NOTE: go expects specific checkout path representing url #### expecting it in the form of #### /go/src/github.com/circleci/go-tool #### /go/src/bitbucket.org/circleci/go-tool working_directory: ~/src/github.com/goombaio/namegenerator steps: - checkout # specify any bash command here prefixed with `run: ` - run: make deps - run: make dev-deps - run: make test - run: make test-race - run: make cover-profile - run: bash <(curl -s https://codecov.io/bash) benchmark: docker: # specify the version - image: circleci/golang:latest # Specify service dependencies here if necessary # CircleCI maintains a library of pre-built images # documented at https://circleci.com/docs/2.0/circleci-images/ # - image: circleci/postgres:9.4 #### TEMPLATE_NOTE: go expects specific checkout path representing url #### expecting it in the form of #### /go/src/github.com/circleci/go-tool #### /go/src/bitbucket.org/circleci/go-tool working_directory: ~/src/github.com/goombaio/namegenerator steps: - checkout # specify any bash command here prefixed with `run: ` - run: make deps - run: make dev-deps - run: make benchmark benchmark: docker: # specify the version - image: circleci/golang:latest # Specify service dependencies here if necessary # CircleCI maintains a library of pre-built images # documented at https://circleci.com/docs/2.0/circleci-images/ # - image: circleci/postgres:9.4 #### TEMPLATE_NOTE: go expects specific checkout path representing url #### expecting it in the form of #### /go/src/github.com/circleci/go-tool #### /go/src/bitbucket.org/circleci/go-tool working_directory: ~/src/github.com/goombaio/namegenerator steps: - checkout # specify any bash command here prefixed with `run: ` - run: make deps - run: make dev-deps - run: make lint workflows: version: 2 workflow: jobs: - build # - benchmarks # - lint namegenerator-0.0.2/.github/000077500000000000000000000000001335624420500157045ustar00rootroot00000000000000namegenerator-0.0.2/.github/CODE_OF_CONDUCT.md000066400000000000000000000062121335624420500205040ustar00rootroot00000000000000# Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [INSERT EMAIL ADDRESS]. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html [homepage]: https://www.contributor-covenant.org namegenerator-0.0.2/.github/CONTRIBUTING.md000066400000000000000000000023321335624420500201350ustar00rootroot00000000000000# Contributing guidelines We want to make contributing to this project as easy and transparent as possible, whether it's: - Reporting a bug - Discussing the current state of the code - Submitting a fix - Proposing new features - Becoming a maintainer ## We Develop with Github We use github to host code, to track issues and feature requests, as well as accept pull requests. ## All code changes happen through pull requests Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests: 1. Fork the repo and create your branch from `master`. 2. If you've added code that should be tested, add tests. 3. If you've changed APIs, update the documentation. 4. Ensure the test suite passes. 5. Make sure your code lints. 6. Issue that pull request! ## Write bug reports with detail, background, and sample code A great bug report tend to have: - A quick summary and/or background - Steps to reproduce - Be specific! - Give sample code if you can - What actually happens - Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) ## License By contributing, you agree that your contributions will be licensed under the same project license.namegenerator-0.0.2/.github/ISSUE_TEMPLATE.md000066400000000000000000000006131335624420500204110ustar00rootroot00000000000000## Description _Describe the issue._ ## Steps to reproduce 1. [First Step] 2. [Second Step] 3. [and so on...] #### Expected behavior _What you expect to happen_ #### Actual behavior _What actually happens_ #### Reproduces how often _What percentage of the time does it reproduce?_ ## Additional information _Any additional information, configuration or data related with the issue._ namegenerator-0.0.2/.github/ISSUE_TEMPLATE/000077500000000000000000000000001335624420500200675ustar00rootroot00000000000000namegenerator-0.0.2/.github/ISSUE_TEMPLATE/bug_report.md000066400000000000000000000014371335624420500225660ustar00rootroot00000000000000--- name: Bug report about: Create a report to help us improve --- **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - OS: [e.g. iOS] - Browser [e.g. chrome, safari] - Version [e.g. 22] **Smartphone (please complete the following information):** - Device: [e.g. iPhone6] - OS: [e.g. iOS8.1] - Browser [e.g. stock browser, safari] - Version [e.g. 22] **Additional context** Add any other context about the problem here. namegenerator-0.0.2/.github/ISSUE_TEMPLATE/feature_request.md000066400000000000000000000010601335624420500236110ustar00rootroot00000000000000--- name: Feature request about: Suggest an idea for this project --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here. namegenerator-0.0.2/.github/PULL_REQUEST_TEMPLATE.md000066400000000000000000000006531335624420500215110ustar00rootroot00000000000000## Description _Describe the problem or feature in addition to a link to the issues._ ## Approach _How does this change address the problem?_ #### Open questions - [ ] Use github checklists. When solved, check the box and explain the answer. ## Additional information _Describe the stage_ _Links to blog posts, patterns, libraries or addons used to solve this problem_ _Add other notes related with this pull request_ namegenerator-0.0.2/.gitignore000066400000000000000000000003001335624420500163250ustar00rootroot00000000000000# Binaries for programs and plugins *.exe *.exe~ *.dll *.so *.dylib # Test binary, build with `go test -c` *.test # Output of the go coverage tool, specifically when used with LiteIDE *.out namegenerator-0.0.2/AUTHORS000066400000000000000000000000541335624420500154130ustar00rootroot00000000000000Raül Pérez (repejota) namegenerator-0.0.2/CONTRIBUTORS000066400000000000000000000000001335624420500162120ustar00rootroot00000000000000namegenerator-0.0.2/HACKING.md000066400000000000000000000004041335624420500157300ustar00rootroot00000000000000# Hacking ## Install deps, dev-deps and run test ```sh $ git clone git@github.com:goombaio/namegenerator.git $ cd skeleton export GO111MODULE=on # ref: https://dave.cheney.net/2018/07/16/using-go-modules-with-travis-ci make deps make dev-deps make test ``` namegenerator-0.0.2/LICENSE000066400000000000000000000261351335624420500153600ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namegenerator-0.0.2/Makefile000066400000000000000000000036771335624420500160210ustar00rootroot00000000000000include Makefile.help.mk BINARY=namegenerator MAIN_PACKAGE=cmd/${BINARY}/main.go PACKAGES = $(shell go list ./...) VERSION=`cat VERSION` BUILD=`git symbolic-ref HEAD 2> /dev/null | cut -b 12-`-`git log --pretty=format:%h -1` DIST_FOLDER=dist DIST_INCLUDE_FILES=README.md LICENSE VERSION # Setup -ldflags option for go build here, interpolate the variable values LDFLAGS=-ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD}" # Build & Install install: ## Build and install package on your system go install $(LDFLAGS) -v $(PACKAGES) .PHONY: version version: ## Show version information @echo $(VERSION)-$(BUILD) # Testing .PHONY: test test: ## Execute package tests go test -v $(PACKAGES) .PHONY: test-race test-race: go test -race -v $(PACKAGES) .PHONY: cover-profile cover-profile: echo "mode: count" > coverage-all.out $(foreach pkg,$(PACKAGES),\ go test -coverprofile=coverage.out -covermode=count $(pkg);\ tail -n +2 coverage.out >> coverage-all.out;) rm -rf coverage.out .PHONY: cover cover: cover-profile cover: ## Generate test coverage data go tool cover -func=coverage-all.out .PHONY: cover-html cover-html: cover-profile cover-html: ## Generate coverage report go tool cover -html=coverage-all.out .PHONY: codecov codecov: bash <(curl -s https://codecov.io/bash) # BenchMarking .PHONY: benchmark benchmark: ## Execute package benchmarks go test -v $(PACKAGES) -benchmem -bench . # Dependencies deps: ## Install build dependencies go get -u=patch go mod tidy -v go mod download go mod verify dev-deps: deps dev-deps: ## Install dev and build dependencies .PHONY: clean clean: ## Delete generated development environment go clean rm -rf ${BINARY}-*-* rm -rf ${BINARY}-*-*.exe rm -rf ${BINARY}-*-*.zip rm -rf coverage-all.out # Lint .PHONY: lint lint: ## Lint source code ./lint.bash # Docs godoc-serve: ## Serve documentation (godoc format) for this package at port HTTP 9090 godoc -http=":9090" namegenerator-0.0.2/Makefile.help.mk000066400000000000000000000002411335624420500173360ustar00rootroot00000000000000.PHONY: help help: ## Show this help ( default ) @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' .DEFAULT_GOAL := help namegenerator-0.0.2/README.md000066400000000000000000000044141335624420500156260ustar00rootroot00000000000000# namegenerator A random name generator (for projects, servers, cluster nodes, etc ...) implementation in Golang. ## Badges [![License][License-Image]][License-URL] [![CircleCI Status][CircleCI-Image]][CircleCI-URL] [![Coverage Report][Coverage-Image]][Coverage-URL] [![Go Report Card][GoReportCard-Image]][GoReportCard-URL] [![CII Best Practices][CII-Image]][CII-URL] [![GoDoc][GoDoc-Image]][GoDoc-URL] ## Install ```bash go get github.com/goombaio/namegenerator ``` You can also update an already installed version: ```bash go get -u github.com/goombaio/namegenerator ``` ## Example of use ```go package main import ( "github.com/goombaio/namegenerator" ) func main() { seed := time.Now().UTC().UnixNano() nameGenerator := namegenerator.NewNameGenerator(seed) name := nameGenerator.Generate() fmt.Println(name) } ``` ## License Copyright (c) 2018 Goomba project Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. [License-Image]: https://img.shields.io/badge/License-Apache-blue.svg [License-URL]: http://opensource.org/licenses/Apache [CircleCI-Image]: https://circleci.com/gh/goombaio/namegenerator.svg?style=svg [CircleCI-URL]: https://circleci.com/gh/goombaio/namegenerator [Coverage-Image]: https://codecov.io/gh/goombaio/namegenerator/branch/master/graph/badge.svg [Coverage-URL]: https://codecov.io/gh/goombaio/namegenerator [GoReportCard-Image]: https://goreportcard.com/badge/github.com/goombaio/namegenerator [GoReportCard-URL]: https://goreportcard.com/report/github.com/goombaio/namegenerator [CII-Image]: https://bestpractices.coreinfrastructure.org/projects/2237/badge [CII-URL]: https://bestpractices.coreinfrastructure.org/projects/2237 [GoDoc-Image]: https://godoc.org/github.com/goombaio/namegenerator?status.svg [GoDoc-URL]: http://godoc.org/github.com/goombaio/namegenerator namegenerator-0.0.2/VERSION000066400000000000000000000000051335624420500154070ustar00rootroot000000000000000.0.2namegenerator-0.0.2/data.go000066400000000000000000000042421335624420500156060ustar00rootroot00000000000000// Copyright 2018, Goomba project Authors. All rights reserved. // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with this // work for additional information regarding copyright ownership. The ASF // licenses this file to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations // under the License. package namegenerator var ( // ADJECTIVES ... ADJECTIVES = []string{"autumn", "hidden", "bitter", "misty", "silent", "empty", "dry", "dark", "summer", "icy", "delicate", "quiet", "white", "cool", "spring", "winter", "patient", "twilight", "dawn", "crimson", "wispy", "weathered", "blue", "billowing", "broken", "cold", "damp", "falling", "frosty", "green", "long", "late", "lingering", "bold", "little", "morning", "muddy", "old", "red", "rough", "still", "small", "sparkling", "throbbing", "shy", "wandering", "withered", "wild", "black", "young", "holy", "solitary", "fragrant", "aged", "snowy", "proud", "floral", "restless", "divine", "polished", "ancient", "purple", "lively", "nameless"} // NOUNS ... NOUNS = []string{"waterfall", "river", "breeze", "moon", "rain", "wind", "sea", "morning", "snow", "lake", "sunset", "pine", "shadow", "leaf", "dawn", "glitter", "forest", "hill", "cloud", "meadow", "sun", "glade", "bird", "brook", "butterfly", "bush", "dew", "dust", "field", "fire", "flower", "firefly", "feather", "grass", "haze", "mountain", "night", "pond", "darkness", "snowflake", "silence", "sound", "sky", "shape", "surf", "thunder", "violet", "water", "wildflower", "wave", "water", "resonance", "sun", "wood", "dream", "cherry", "tree", "fog", "frost", "voice", "paper", "frog", "smoke", "star"} ) namegenerator-0.0.2/data_test.go000066400000000000000000000015671335624420500166540ustar00rootroot00000000000000// Copyright 2018, Goomba project Authors. All rights reserved. // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with this // work for additional information regarding copyright ownership. The ASF // licenses this file to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations // under the License. package namegenerator_test namegenerator-0.0.2/doc.go000066400000000000000000000015621335624420500154440ustar00rootroot00000000000000// Copyright 2018, Goomba project Authors. All rights reserved. // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with this // work for additional information regarding copyright ownership. The ASF // licenses this file to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations // under the License. package namegenerator namegenerator-0.0.2/example_test.go000066400000000000000000000022571335624420500173730ustar00rootroot00000000000000// Copyright 2018, Goomba project Authors. All rights reserved. // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with this // work for additional information regarding copyright ownership. The ASF // licenses this file to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations // under the License. package namegenerator_test import ( "fmt" "time" "github.com/goombaio/namegenerator" ) // ExampleNameGenerator ... func ExampleNameGenerator() { seed := time.Now().UTC().UnixNano() nameGenerator := namegenerator.NewNameGenerator(seed) name := nameGenerator.Generate() fmt.Println(name) // // Output: // // autum-waterfall } namegenerator-0.0.2/generator.go000066400000000000000000000027721335624420500166710ustar00rootroot00000000000000// Copyright 2018, Goomba project Authors. All rights reserved. // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with this // work for additional information regarding copyright ownership. The ASF // licenses this file to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations // under the License. package namegenerator import ( "fmt" "math/rand" ) // Generator ... type Generator interface { Generate() string } // NameGenerator ... type NameGenerator struct { random *rand.Rand } // Generate ... func (rn *NameGenerator) Generate() string { randomAdjective := ADJECTIVES[rn.random.Intn(len(ADJECTIVES))] randomNoun := NOUNS[rn.random.Intn(len(NOUNS))] randomName := fmt.Sprintf("%v-%v", randomAdjective, randomNoun) return randomName } // NewNameGenerator ... func NewNameGenerator(seed int64) Generator { nameGenerator := &NameGenerator{ random: rand.New(rand.New(rand.NewSource(99))), } nameGenerator.random.Seed(seed) return nameGenerator } namegenerator-0.0.2/generator_test.go000066400000000000000000000023551335624420500177250ustar00rootroot00000000000000// Copyright 2018, Goomba project Authors. All rights reserved. // // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with this // work for additional information regarding copyright ownership. The ASF // licenses this file to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations // under the License. package namegenerator import ( "testing" "time" ) func TestNameGenerator(t *testing.T) { seed := time.Now().UTC().UnixNano() _ = NewNameGenerator(seed) } func TestNameGenerator_Generate(t *testing.T) { seed := time.Now().UTC().UnixNano() nameGenerator := NewNameGenerator(seed) name := nameGenerator.Generate() if name == "" { t.Fatalf("Expected a new name but got a blank string") } } namegenerator-0.0.2/go.mod000066400000000000000000000000511335624420500154460ustar00rootroot00000000000000module github.com/goombaio/namegenerator namegenerator-0.0.2/lint.bash000077500000000000000000000012761335624420500161620ustar00rootroot00000000000000#!/usr/bin/env bash set -o errexit set -o nounset set -o pipefail # gometalinter if [ ! $(command -v gometalinter) ] then go get github.com/alecthomas/gometalinter gometalinter --update --install fi echo "gometalinter:" time gometalinter \ --exclude='/thrift/' \ --exclude='/pb/' \ --exclude='no args in Log call \(vet\)' \ --disable=errcheck \ --disable=dupl \ --disable=aligncheck \ --disable=gotype \ --cyclo-over=20 \ --tests \ --concurrency=2 \ --deadline=300s \ ./... echo # golangci-lint if [ ! $(command -v golangci-lint) ] then go get github.com/golangci/golangci-lint/cmd/golangci-lint fi echo "golangci-lint:" time golangci-lint \ run \ --disable errcheck \ ./...