use regex::Regex;
pub struct GoPatterns {
external_patterns: Vec<Regex>,
cache_patterns: Vec<Regex>,
extensions: Vec<String>,
}
impl GoPatterns {
pub fn new() -> Self {
let external_patterns = vec![
Regex::new(r"go\.mod$").unwrap(),
Regex::new(r"go\.sum$").unwrap(),
Regex::new(r"go\.work$").unwrap(),
Regex::new(r"go\.work\.sum$").unwrap(),
Regex::new(r"vendor/").unwrap(),
Regex::new(r"\.exe$").unwrap(),
Regex::new(r"\.out$").unwrap(),
Regex::new(r"\.test$").unwrap(),
Regex::new(r"\.prof$").unwrap(),
Regex::new(r"\.mem$").unwrap(),
Regex::new(r"\.cpu$").unwrap(),
Regex::new(r"\.cover$").unwrap(),
Regex::new(r"coverage\.out$").unwrap(),
Regex::new(r"coverage\.html$").unwrap(),
Regex::new(r"bin/").unwrap(),
Regex::new(r"dist/").unwrap(),
Regex::new(r"\.pb\.go$").unwrap(),
Regex::new(r"\.pb\.gw\.go$").unwrap(),
Regex::new(r"bindata\.go$").unwrap(),
Regex::new(r"_gen\.go$").unwrap(),
Regex::new(r"_generated\.go$").unwrap(),
Regex::new(r"\.vscode/").unwrap(),
Regex::new(r"\.idea/").unwrap(),
Regex::new(r"\.DS_Store").unwrap(),
Regex::new(r"Thumbs\.db").unwrap(),
Regex::new(r"\.tmp$").unwrap(),
Regex::new(r"\.swp$").unwrap(),
Regex::new(r"\.swo$").unwrap(),
Regex::new(r"~$").unwrap(),
Regex::new(r"\.dockerignore$").unwrap(),
Regex::new(r"\.air\.toml$").unwrap(),
Regex::new(r"tmp/").unwrap(),
Regex::new(r"debug$").unwrap(),
Regex::new(r"debug\.exe$").unwrap(),
Regex::new(r"\.vscode/launch\.json$").unwrap(),
Regex::new(r"fyne-cross/").unwrap(),
Regex::new(r"wire_gen\.go$").unwrap(),
Regex::new(r"docs/").unwrap(),
Regex::new(r"mage_output_file\.go$").unwrap(),
];
let cache_patterns = vec![
Regex::new(r"\.go/pkg/mod/").unwrap(),
Regex::new(r"\.go/pkg/sumdb/").unwrap(),
Regex::new(r"\.go/pkg/testcache/").unwrap(),
Regex::new(r"\.vscode/").unwrap(),
Regex::new(r"\.idea/").unwrap(),
Regex::new(r"tmp/").unwrap(),
Regex::new(r"bin/").unwrap(),
Regex::new(r"dist/").unwrap(),
Regex::new(r"\.cover$").unwrap(),
Regex::new(r"coverage\.").unwrap(),
Regex::new(r"\.prof$").unwrap(),
Regex::new(r"\.mem$").unwrap(),
Regex::new(r"\.cpu$").unwrap(),
Regex::new(r"\.tmp$").unwrap(),
Regex::new(r"\.temp$").unwrap(),
Regex::new(r"\.log$").unwrap(),
Regex::new(r"\.bak$").unwrap(),
Regex::new(r"\.backup$").unwrap(),
Regex::new(r"\.DS_Store").unwrap(),
Regex::new(r"Thumbs\.db").unwrap(),
Regex::new(r"\.swp$").unwrap(),
Regex::new(r"\.swo$").unwrap(),
Regex::new(r"~$").unwrap(),
Regex::new(r"\.idea/").unwrap(),
Regex::new(r"\.vscode/").unwrap(),
Regex::new(r"\.vim/").unwrap(),
Regex::new(r"\.emacs\.d/").unwrap(),
Regex::new(r"\.sublime-").unwrap(),
Regex::new(r"\.atom/").unwrap(),
Regex::new(r"\.brackets\.json").unwrap(),
Regex::new(r"\.nova/").unwrap(),
Regex::new(r"\.zed/").unwrap(),
];
let extensions = vec![
"go".to_string(),
"mod".to_string(),
"sum".to_string(),
"work".to_string(),
"s".to_string(),
"tmpl".to_string(),
"tpl".to_string(),
"gotmpl".to_string(),
"gohtml".to_string(),
"gotxt".to_string(),
"proto".to_string(),
"yaml".to_string(),
"yml".to_string(),
"json".to_string(),
"toml".to_string(),
"md".to_string(),
];
Self {
external_patterns,
cache_patterns,
extensions,
}
}
pub fn get_external_patterns(&self) -> &[Regex] {
&self.external_patterns
}
pub fn get_cache_patterns(&self) -> &[Regex] {
&self.cache_patterns
}
pub fn get_extensions(&self) -> &[String] {
&self.extensions
}
pub fn get_script_names() -> Vec<&'static str> {
vec![
"go.mod", "go.sum", "go.work", "go.work.sum",
"main.go", "cmd/main.go",
"Makefile", "makefile", "build.sh", "build.bat",
"build.ps1", "build.py", "build.go",
"magefile.go", "mage.go",
"Taskfile.yml", "Taskfile.yaml",
"Dockerfile", "docker-compose.yml", "docker-compose.yaml",
".dockerignore", "Dockerfile.dev", "Dockerfile.prod",
".air.toml", "air.conf",
"config.yaml", "config.yml", "config.json",
"config.toml", "settings.yaml", "app.yaml",
".env", ".env.local", ".env.development", ".env.production",
".env.test", ".env.example",
".github/workflows/go.yml", ".github/workflows/test.yml",
".github/workflows/build.yml", ".github/workflows/release.yml",
".gitlab-ci.yml", "azure-pipelines.yml", "Jenkinsfile",
"bitbucket-pipelines.yml", "circle.yml", ".circleci/config.yml",
".travis.yml", "appveyor.yml", "cloudbuild.yaml",
"go.test", "coverage.out", "coverage.html",
"benchmark.out", "profile.out",
".golangci.yml", ".golangci.yaml", "golangci.yml",
".gofmt", ".goimports", ".golint",
"README.md", "CHANGELOG.md", "CONTRIBUTING.md",
"LICENSE", "LICENSE.md", "COPYING",
"doc.go", "docs.go",
"swagger.yaml", "swagger.yml", "swagger.json",
"openapi.yaml", "openapi.yml", "openapi.json",
"api.yaml", "api.yml", "api.json",
"*.proto", "buf.yaml", "buf.yml", "buf.gen.yaml",
"buf.work.yaml", "buf.lock",
"grpc.proto", "service.proto",
"migrate.go", "schema.sql", "migrations/",
"k8s.yaml", "k8s.yml", "kubernetes.yaml",
"deployment.yaml", "service.yaml", "ingress.yaml",
"configmap.yaml", "secret.yaml",
"Chart.yaml", "values.yaml", "values.yml",
"requirements.yaml", "requirements.lock",
"main.tf", "variables.tf", "outputs.tf",
"terraform.tfvars", "terraform.tfstate",
"prometheus.yml", "grafana.json",
"jaeger.yaml", "zipkin.yaml",
"logrus.yaml", "zap.yaml", "zerolog.yaml",
"gin.go", "echo.go", "fiber.go", "chi.go",
"gorilla.go", "httprouter.go", "mux.go",
"gorm.go", "ent.go", "sqlx.go", "xorm.go",
"rabbitmq.go", "kafka.go", "nats.go", "redis.go",
"redis.go", "memcached.go", "cache.go",
"jwt.go", "oauth.go", "auth.go", "session.go",
"validator.go", "validate.go",
"json.go", "xml.go", "yaml.go", "toml.go",
"protobuf.go", "msgpack.go", "avro.go",
"client.go", "http.go", "rest.go", "graphql.go",
"utils.go", "helpers.go", "common.go", "shared.go",
"constants.go", "const.go", "vars.go",
"errors.go", "error.go", "exceptions.go",
"types.go", "models.go", "structs.go", "entities.go",
"interfaces.go", "interface.go", "contracts.go",
"handlers.go", "handler.go", "routes.go", "router.go",
"middleware.go", "middlewares.go",
"service.go", "services.go", "business.go",
"repository.go", "repositories.go", "repo.go",
"storage.go", "store.go", "dao.go",
"controller.go", "controllers.go", "ctrl.go",
"view.go", "views.go", "templates.go",
"model.go", "models.go", "entity.go", "entities.go",
"dto.go", "dtos.go", "request.go", "response.go",
"config.go", "configuration.go", "settings.go",
"db.go", "database.go", "connection.go", "conn.go",
"migration.go", "migrations.go", "migrate.go",
"seed.go", "seeds.go", "seeder.go", "seeders.go",
"*_test.go", "test.go", "tests.go", "testing.go",
"benchmark.go", "benchmarks.go", "example.go",
"mock.go", "mocks.go", "fake.go", "fakes.go",
"stub.go", "stubs.go",
"fixture.go", "fixtures.go", "testdata.go",
"factory.go", "factories.go", "builder.go", "builders.go",
"generator.go", "generators.go", "generate.go",
"parser.go", "parsers.go", "parse.go",
"validator.go", "validators.go", "validation.go",
"serializer.go", "serializers.go", "serialize.go",
"transformer.go", "transformers.go", "transform.go",
"converter.go", "converters.go", "convert.go",
"mapper.go", "mappers.go", "mapping.go",
"filter.go", "filters.go", "filtering.go",
"sorter.go", "sorters.go", "sorting.go",
"pagination.go", "paginate.go", "paging.go",
"search.go", "searcher.go", "searching.go",
"cache.go", "caching.go", "cached.go",
"queue.go", "queues.go", "job.go", "jobs.go",
"worker.go", "workers.go", "task.go", "tasks.go",
"scheduler.go", "schedule.go", "cron.go",
"event.go", "events.go", "eventbus.go",
"dispatcher.go", "listener.go", "listeners.go",
"notification.go", "notifications.go", "notify.go",
"email.go", "mail.go", "mailer.go", "smtp.go",
"sms.go", "text.go", "messaging.go",
"push.go", "fcm.go", "apns.go",
"file.go", "files.go", "filesystem.go", "storage.go",
"upload.go", "uploads.go", "download.go", "downloads.go",
"image.go", "images.go", "resize.go", "thumbnail.go",
"pdf.go", "pdfs.go", "report.go", "reports.go",
"excel.go", "xlsx.go", "csv.go", "spreadsheet.go",
"compress.go", "compression.go", "zip.go", "gzip.go",
"encrypt.go", "encryption.go", "crypto.go", "security.go",
"hash.go", "hashing.go", "jwt.go", "token.go", "tokens.go",
"log.go", "logger.go", "logging.go", "logs.go",
"metrics.go", "metric.go", "monitoring.go", "stats.go",
"health.go", "healthcheck.go", "ping.go", "status.go",
"ratelimit.go", "throttle.go", "limiter.go",
"circuit.go", "breaker.go", "hystrix.go",
"retry.go", "backoff.go", "exponential.go",
"timeout.go", "deadline.go", "context.go",
"shutdown.go", "graceful.go", "signal.go", "signals.go",
"profile.go", "profiling.go", "pprof.go",
"benchmark.go", "benchmarks.go", "bench.go",
"load.go", "loadtest.go", "stress.go", "stresstest.go",
"version.go", "versions.go", "build.go", "info.go",
"cli.go", "cmd.go", "command.go", "commands.go",
"flag.go", "flags.go", "args.go", "arguments.go",
"server.go", "servers.go", "app.go", "application.go",
"client.go", "clients.go", "api.go", "apis.go",
"proxy.go", "proxies.go", "gateway.go", "gateways.go",
"loadbalancer.go", "balancer.go", "lb.go",
"discovery.go", "registry.go", "consul.go", "etcd.go",
"consul.go", "etcd.go", "vault.go", "k8s.go",
"trace.go", "tracing.go", "jaeger.go", "zipkin.go",
"opentracing.go", "opentelemetry.go",
"deploy.go", "deployment.go", "k8s.go", "kubernetes.go",
"docker.go", "container.go", "containers.go",
"infrastructure.go", "infra.go", "terraform.go",
"cloudformation.go", "aws.go", "gcp.go", "azure.go",
"prometheus.go", "grafana.go", "datadog.go", "newrelic.go",
"alert.go", "alerts.go", "pagerduty.go", "slack.go",
"backup.go", "backups.go", "restore.go", "recovery.go",
"disaster.go", "recovery.go", "failover.go", "replication.go",
"performance.go", "perf.go", "optimization.go", "optimize.go",
"scale.go", "scaling.go", "autoscale.go", "horizontal.go",
"vertical.go", "cluster.go", "clusters.go",
"reliability.go", "reliable.go", "resilience.go", "fault.go",
"tolerance.go", "availability.go", "uptime.go",
"maintenance.go", "maintain.go", "cleanup.go", "clean.go",
"garbage.go", "gc.go", "housekeeping.go",
"migration.go", "migrations.go", "migrate.go", "upgrade.go",
"downgrade.go", "rollback.go", "revert.go",
"i18n.go", "l10n.go", "locale.go", "locales.go",
"translation.go", "translations.go", "language.go", "languages.go",
"a11y.go", "accessibility.go", "wcag.go", "aria.go",
"seo.go", "sitemap.go", "robots.go", "meta.go",
"analytics.go", "tracking.go", "ga.go", "gtm.go",
"ab.go", "abtest.go", "experiment.go", "experiments.go",
"feature.go", "features.go", "flag.go", "flags.go",
"social.go", "facebook.go", "twitter.go", "instagram.go",
"linkedin.go", "youtube.go", "tiktok.go",
"payment.go", "payments.go", "stripe.go", "paypal.go",
"square.go", "braintree.go", "checkout.go", "billing.go",
"subscription.go", "subscriptions.go", "plan.go", "plans.go",
"tier.go", "tiers.go", "pricing.go", "invoice.go", "invoices.go",
"inventory.go", "stock.go", "warehouse.go", "product.go", "products.go",
"catalog.go", "category.go", "categories.go",
"order.go", "orders.go", "cart.go", "carts.go",
"checkout.go", "fulfillment.go", "shipping.go",
"customer.go", "customers.go", "user.go", "users.go",
"account.go", "accounts.go", "profile.go", "profiles.go",
"content.go", "cms.go", "page.go", "pages.go",
"post.go", "posts.go", "article.go", "articles.go",
"blog.go", "news.go", "media.go",
"forum.go", "forums.go", "thread.go", "threads.go",
"topic.go", "topics.go", "comment.go", "comments.go",
"reply.go", "replies.go", "vote.go", "votes.go",
"chat.go", "message.go", "messages.go", "room.go", "rooms.go",
"channel.go", "channels.go", "websocket.go", "ws.go",
"realtime.go", "live.go", "streaming.go", "stream.go", "streams.go",
"sse.go", "websocket.go", "ws.go", "socket.go", "sockets.go",
"game.go", "games.go", "player.go", "players.go",
"match.go", "matches.go", "tournament.go", "tournaments.go",
"leaderboard.go", "score.go", "scores.go",
"iot.go", "device.go", "devices.go", "sensor.go", "sensors.go",
"actuator.go", "actuators.go", "mqtt.go", "coap.go",
"blockchain.go", "bitcoin.go", "ethereum.go", "smart.go",
"contract.go", "contracts.go", "wallet.go", "wallets.go",
"transaction.go", "transactions.go", "mining.go",
"ml.go", "ai.go", "neural.go", "network.go", "networks.go",
"model.go", "models.go", "training.go", "inference.go",
"prediction.go", "predictions.go", "classification.go",
"data.go", "dataset.go", "datasets.go", "analysis.go",
"visualization.go", "chart.go", "charts.go", "graph.go", "graphs.go",
"statistics.go", "stats.go", "math.go", "algorithm.go", "algorithms.go",
"bigdata.go", "hadoop.go", "spark.go", "kafka.go",
"elasticsearch.go", "solr.go", "lucene.go", "search.go",
"timeseries.go", "time.go", "series.go", "metric.go", "metrics.go",
"influxdb.go", "prometheus.go", "grafana.go",
"geo.go", "location.go", "locations.go", "map.go", "maps.go",
"gps.go", "coordinate.go", "coordinates.go", "distance.go",
"weather.go", "forecast.go", "climate.go", "temperature.go",
"humidity.go", "pressure.go", "wind.go", "rain.go",
"finance.go", "financial.go", "accounting.go", "budget.go", "budgets.go",
"expense.go", "expenses.go", "income.go", "revenue.go",
"profit.go", "loss.go", "tax.go", "taxes.go",
"hr.go", "human.go", "resources.go", "employee.go", "employees.go",
"payroll.go", "salary.go", "salaries.go", "benefit.go", "benefits.go",
"leave.go", "attendance.go", "performance.go", "review.go", "reviews.go",
"legal.go", "law.go", "compliance.go", "regulation.go", "regulations.go",
"policy.go", "policies.go", "contract.go", "contracts.go",
"agreement.go", "agreements.go", "license.go", "licenses.go",
"education.go", "school.go", "schools.go", "student.go", "students.go",
"teacher.go", "teachers.go", "course.go", "courses.go",
"lesson.go", "lessons.go", "exam.go", "exams.go",
"grade.go", "grades.go", "assignment.go", "assignments.go",
"health.go", "healthcare.go", "medical.go", "patient.go", "patients.go",
"doctor.go", "doctors.go", "appointment.go", "appointments.go",
"prescription.go", "prescriptions.go", "diagnosis.go", "treatment.go",
"travel.go", "trip.go", "trips.go", "booking.go", "bookings.go",
"hotel.go", "hotels.go", "flight.go", "flights.go",
"car.go", "cars.go", "rental.go", "rentals.go",
"food.go", "restaurant.go", "restaurants.go", "menu.go", "menus.go",
"recipe.go", "recipes.go", "ingredient.go", "ingredients.go",
"nutrition.go", "diet.go", "meal.go", "meals.go",
"sports.go", "sport.go", "team.go", "teams.go",
"athlete.go", "athletes.go", "competition.go", "competitions.go",
"season.go", "seasons.go", "league.go", "leagues.go",
"entertainment.go", "movie.go", "movies.go", "tv.go", "show.go", "shows.go",
"music.go", "song.go", "songs.go", "album.go", "albums.go",
"artist.go", "artists.go", "book.go", "books.go",
"news.go", "article.go", "articles.go", "story.go", "stories.go",
"headline.go", "headlines.go", "reporter.go", "reporters.go",
"editor.go", "editors.go", "publisher.go", "publishers.go",
"weather.go", "forecast.go", "climate.go", "temperature.go",
"humidity.go", "pressure.go", "wind.go", "rain.go", "snow.go",
"transport.go", "transportation.go", "vehicle.go", "vehicles.go",
"bus.go", "buses.go", "train.go", "trains.go",
"subway.go", "metro.go", "taxi.go", "uber.go", "lyft.go",
"realestate.go", "property.go", "properties.go", "house.go", "houses.go",
"apartment.go", "apartments.go", "rent.go", "rental.go", "rentals.go",
"sale.go", "sales.go", "mortgage.go", "mortgages.go",
"insurance.go", "policy.go", "policies.go", "claim.go", "claims.go",
"premium.go", "premiums.go", "coverage.go", "deductible.go",
"bank.go", "banking.go", "account.go", "accounts.go",
"transaction.go", "transactions.go", "transfer.go", "transfers.go",
"loan.go", "loans.go", "credit.go", "debit.go",
"investment.go", "investments.go", "portfolio.go", "portfolios.go",
"stock.go", "stocks.go", "bond.go", "bonds.go",
"fund.go", "funds.go", "etf.go", "etfs.go",
"crypto.go", "cryptocurrency.go", "bitcoin.go", "ethereum.go",
"blockchain.go", "wallet.go", "wallets.go", "exchange.go", "exchanges.go",
"trading.go", "trade.go", "trades.go", "market.go", "markets.go",
"retail.go", "store.go", "stores.go", "shop.go", "shops.go",
"product.go", "products.go", "inventory.go", "stock.go",
"sale.go", "sales.go", "discount.go", "discounts.go",
"manufacturing.go", "factory.go", "factories.go", "production.go",
"assembly.go", "quality.go", "control.go", "testing.go",
"inspection.go", "maintenance.go", "repair.go",
"logistics.go", "supply.go", "chain.go", "warehouse.go", "warehouses.go",
"distribution.go", "delivery.go", "deliveries.go", "shipping.go",
"tracking.go", "route.go", "routes.go",
"agriculture.go", "farm.go", "farms.go", "crop.go", "crops.go",
"livestock.go", "animal.go", "animals.go", "harvest.go",
"irrigation.go", "fertilizer.go", "pesticide.go",
"energy.go", "power.go", "electricity.go", "solar.go",
"wind.go", "nuclear.go", "coal.go", "oil.go", "gas.go",
"renewable.go", "grid.go", "utility.go", "utilities.go",
"environment.go", "environmental.go", "climate.go", "carbon.go",
"emission.go", "emissions.go", "pollution.go", "waste.go",
"recycling.go", "sustainability.go", "green.go", "eco.go",
"government.go", "gov.go", "public.go", "citizen.go", "citizens.go",
"voting.go", "election.go", "elections.go", "democracy.go",
"legislation.go", "law.go", "laws.go", "regulation.go", "regulations.go",
"nonprofit.go", "charity.go", "donation.go", "donations.go",
"volunteer.go", "volunteers.go", "fundraising.go", "grant.go", "grants.go",
"foundation.go", "foundations.go", "cause.go", "causes.go",
]
}
}