From 889c462236049b4712088eac4fa34ef8ff49dd7d Mon Sep 17 00:00:00 2001 From: Kamaleshwar Date: Fri, 16 Feb 2024 18:26:00 +0100 Subject: [PATCH 01/26] basics --- cmd/booking/list | 186 + cmd/booking/main.go | 59 + cmd/server/grpc/grpc.go | 13 + {internal => cmd}/server/http/handlers.go | 10 +- .../server/http/handlers_users.go | 5 +- cmd/server/http/http.go | 95 + cmd/server/http/web/templates/index.html | 41 + cmd/subscribers/kafka/kafka.go | 13 + docker/Dockerfile | 10 +- docker/docker-compose.yml | 4 +- go.mod | 71 +- go.sum | 266 +- internal/api/api.go | 35 +- internal/api/users.go | 4 + internal/configs/configs.go | 45 +- internal/notes/notes.go | 12 - internal/pkg/apm/apm.go | 235 + internal/pkg/apm/grpc_util.go | 92 + internal/pkg/apm/http.go | 24 + internal/pkg/apm/meter.go | 128 + internal/pkg/apm/prometheus.go | 47 + internal/pkg/apm/tracer.go | 53 + internal/pkg/cachestore/cachestore.go | 54 - internal/pkg/logger/default.go | 10 +- internal/pkg/logger/logger.go | 9 +- .../datastore.go => postgres/postgres.go} | 2 +- internal/pkg/sysignals/sysignals.go | 35 + internal/server/http/http.go | 85 - internal/server/http/web/templates/index.html | 28 - internal/users/cache.go | 84 - internal/users/store.go | 100 - internal/users/users.go | 141 +- internal/users/users_test.go | 118 - main.go | 137 +- makeitmine.sh | 97 - .../Masterminds/squirrel/.gitignore | 1 - .../Masterminds/squirrel/.travis.yml | 30 - .../Masterminds/squirrel/LICENSE.txt | 23 - .../github.com/Masterminds/squirrel/README.md | 142 - .../github.com/Masterminds/squirrel/case.go | 128 - .../github.com/Masterminds/squirrel/delete.go | 191 - .../Masterminds/squirrel/delete_ctx.go | 69 - .../github.com/Masterminds/squirrel/expr.go | 419 - .../github.com/Masterminds/squirrel/insert.go | 298 - .../Masterminds/squirrel/insert_ctx.go | 69 - .../github.com/Masterminds/squirrel/part.go | 63 - .../Masterminds/squirrel/placeholder.go | 114 - vendor/github.com/Masterminds/squirrel/row.go | 22 - .../github.com/Masterminds/squirrel/select.go | 396 - .../Masterminds/squirrel/select_ctx.go | 69 - .../Masterminds/squirrel/squirrel.go | 183 - .../Masterminds/squirrel/squirrel_ctx.go | 93 - .../Masterminds/squirrel/statement.go | 104 - .../Masterminds/squirrel/stmtcacher.go | 121 - .../Masterminds/squirrel/stmtcacher_ctx.go | 86 - .../Masterminds/squirrel/stmtcacher_noctx.go | 21 - .../github.com/Masterminds/squirrel/update.go | 266 - .../Masterminds/squirrel/update_ctx.go | 69 - .../github.com/Masterminds/squirrel/where.go | 30 - vendor/github.com/armon/go-radix/.gitignore | 22 - vendor/github.com/armon/go-radix/.travis.yml | 3 - vendor/github.com/armon/go-radix/LICENSE | 20 - vendor/github.com/armon/go-radix/README.md | 38 - vendor/github.com/armon/go-radix/radix.go | 540 - .../github.com/bnkamalesh/errors/.gitignore | 107 - .../github.com/bnkamalesh/errors/.travis.yml | 9 - vendor/github.com/bnkamalesh/errors/LICENSE | 21 - vendor/github.com/bnkamalesh/errors/README.md | 254 - vendor/github.com/bnkamalesh/errors/errors.go | 528 - vendor/github.com/bnkamalesh/errors/helper.go | 370 - vendor/github.com/bnkamalesh/errors/mirror.go | 18 - .../github.com/bnkamalesh/webgo/v6/.gitignore | 87 - .../bnkamalesh/webgo/v6/CODE_OF_CONDUCT.md | 46 - .../bnkamalesh/webgo/v6/CONTRIBUTING.md | 24 - vendor/github.com/bnkamalesh/webgo/v6/LICENSE | 21 - .../github.com/bnkamalesh/webgo/v6/README.md | 222 - .../bnkamalesh/webgo/v6/_config.yml | 1 - .../github.com/bnkamalesh/webgo/v6/config.go | 66 - .../github.com/bnkamalesh/webgo/v6/errors.go | 145 - .../v6/middleware/accesslog/accesslog.go | 31 - .../bnkamalesh/webgo/v6/responses.go | 160 - .../github.com/bnkamalesh/webgo/v6/route.go | 252 - .../github.com/bnkamalesh/webgo/v6/router.go | 418 - .../github.com/bnkamalesh/webgo/v6/webgo.go | 187 - .../github.com/cespare/xxhash/v2/LICENSE.txt | 22 - vendor/github.com/cespare/xxhash/v2/README.md | 72 - .../github.com/cespare/xxhash/v2/testall.sh | 10 - vendor/github.com/cespare/xxhash/v2/xxhash.go | 228 - .../cespare/xxhash/v2/xxhash_amd64.s | 209 - .../cespare/xxhash/v2/xxhash_arm64.s | 183 - .../cespare/xxhash/v2/xxhash_asm.go | 15 - .../cespare/xxhash/v2/xxhash_other.go | 76 - .../cespare/xxhash/v2/xxhash_safe.go | 16 - .../cespare/xxhash/v2/xxhash_unsafe.go | 58 - .../github.com/dgryski/go-rendezvous/LICENSE | 21 - .../github.com/dgryski/go-rendezvous/rdv.go | 79 - .../github.com/elastic/go-licenser/.gitignore | 3 - .../elastic/go-licenser/.goreleaser.yml | 32 - .../elastic/go-licenser/CONTRIBUTING.md | 47 - vendor/github.com/elastic/go-licenser/LICENSE | 202 - .../github.com/elastic/go-licenser/Makefile | 102 - vendor/github.com/elastic/go-licenser/NOTICE | 5 - .../github.com/elastic/go-licenser/README.md | 50 - .../elastic/go-licenser/appveyor.yml | 32 - .../github.com/elastic/go-licenser/error.go | 39 - .../elastic/go-licenser/licensing/doc.go | 20 - .../elastic/go-licenser/licensing/license.go | 132 - vendor/github.com/elastic/go-licenser/main.go | 277 - vendor/github.com/elastic/go-licenser/path.go | 54 - .../elastic/go-licenser/testhelpers.go | 151 - .../github.com/elastic/go-licenser/version.go | 23 - .../elastic/go-sysinfo/.editorconfig | 27 - .../elastic/go-sysinfo/.gitattributes | 5 - .../github.com/elastic/go-sysinfo/.gitignore | 13 - .../elastic/go-sysinfo/CHANGELOG.md | 165 - .../github.com/elastic/go-sysinfo/LICENSE.txt | 202 - vendor/github.com/elastic/go-sysinfo/Makefile | 14 - .../github.com/elastic/go-sysinfo/NOTICE.txt | 5 - .../github.com/elastic/go-sysinfo/README.md | 81 - .../go-sysinfo/internal/registry/registry.go | 58 - .../providers/aix/boottime_aix_ppc64.go | 79 - .../elastic/go-sysinfo/providers/aix/doc.go | 20 - .../providers/aix/host_aix_ppc64.go | 215 - .../providers/aix/kernel_aix_ppc64.go | 60 - .../providers/aix/machineid_aix_ppc64.go | 37 - .../go-sysinfo/providers/aix/os_aix_ppc64.go | 61 - .../providers/aix/process_aix_ppc64.go | 302 - .../providers/aix/ztypes_aix_ppc64.go | 159 - .../providers/darwin/arch_darwin.go | 38 - .../providers/darwin/boottime_darwin.go | 40 - .../go-sysinfo/providers/darwin/doc.go | 20 - .../providers/darwin/host_darwin.go | 251 - .../providers/darwin/kernel_darwin.go | 37 - .../providers/darwin/load_average_darwin.go | 45 - .../providers/darwin/machineid_darwin.go | 61 - .../darwin/machineid_nocgo_darwin.go | 30 - .../providers/darwin/memory_darwin.go | 38 - .../elastic/go-sysinfo/providers/darwin/os.go | 94 - .../providers/darwin/process_cgo_darwin.go | 59 - .../providers/darwin/process_darwin.go | 242 - .../providers/darwin/process_nocgo_darwin.go | 30 - .../providers/darwin/syscall_cgo_darwin.go | 72 - .../providers/darwin/syscall_darwin.go | 69 - .../providers/darwin/syscall_nocgo_darwin.go | 39 - .../providers/darwin/ztypes_darwin.go | 187 - .../go-sysinfo/providers/linux/arch_linux.go | 40 - .../providers/linux/boottime_linux.go | 47 - .../providers/linux/capabilities_linux.go | 118 - .../go-sysinfo/providers/linux/container.go | 57 - .../elastic/go-sysinfo/providers/linux/doc.go | 20 - .../go-sysinfo/providers/linux/host_linux.go | 258 - .../providers/linux/kernel_linux.go | 40 - .../go-sysinfo/providers/linux/machineid.go | 60 - .../providers/linux/memory_linux.go | 72 - .../elastic/go-sysinfo/providers/linux/os.go | 275 - .../providers/linux/process_linux.go | 282 - .../go-sysinfo/providers/linux/procnet.go | 127 - .../providers/linux/seccomp_linux.go | 69 - .../go-sysinfo/providers/linux/util.go | 111 - .../go-sysinfo/providers/linux/vmstat.go | 69 - .../go-sysinfo/providers/shared/network.go | 48 - .../providers/windows/arch_windows.go | 31 - .../providers/windows/boottime_windows.go | 36 - .../providers/windows/device_windows.go | 193 - .../go-sysinfo/providers/windows/doc.go | 20 - .../providers/windows/helpers_windows.go | 41 - .../providers/windows/host_windows.go | 175 - .../providers/windows/kernel_windows.go | 43 - .../providers/windows/machineid_windows.go | 47 - .../providers/windows/os_windows.go | 115 - .../providers/windows/process_windows.go | 383 - .../github.com/elastic/go-sysinfo/system.go | 87 - .../elastic/go-sysinfo/types/errors.go | 23 - .../github.com/elastic/go-sysinfo/types/go.go | 26 - .../elastic/go-sysinfo/types/host.go | 299 - .../elastic/go-sysinfo/types/process.go | 160 - .../elastic/go-windows/.appveyor.yml | 61 - .../elastic/go-windows/.gitattributes | 5 - .../github.com/elastic/go-windows/.gitignore | 24 - .../github.com/elastic/go-windows/.travis.yml | 25 - .../elastic/go-windows/CHANGELOG.md | 41 - .../github.com/elastic/go-windows/LICENSE.txt | 202 - .../github.com/elastic/go-windows/NOTICE.txt | 5 - .../github.com/elastic/go-windows/README.md | 18 - .../github.com/elastic/go-windows/Vagrantfile | 30 - .../elastic/go-windows/constants.go | 32 - vendor/github.com/elastic/go-windows/doc.go | 25 - .../github.com/elastic/go-windows/kernel32.go | 249 - vendor/github.com/elastic/go-windows/ntdll.go | 129 - vendor/github.com/elastic/go-windows/psapi.go | 100 - vendor/github.com/elastic/go-windows/utf16.go | 68 - .../github.com/elastic/go-windows/version.go | 158 - .../elastic/go-windows/zsyscall_windows.go | 250 - .../github.com/jackc/pgpassfile/.travis.yml | 9 - vendor/github.com/jackc/pgpassfile/LICENSE | 22 - vendor/github.com/jackc/pgpassfile/README.md | 8 - vendor/github.com/jackc/pgpassfile/pgpass.go | 110 - .../jackc/pgservicefile/.travis.yml | 9 - vendor/github.com/jackc/pgservicefile/LICENSE | 22 - .../github.com/jackc/pgservicefile/README.md | 6 - .../jackc/pgservicefile/pgservicefile.go | 79 - vendor/github.com/jackc/pgx/v5/.gitignore | 25 - vendor/github.com/jackc/pgx/v5/CHANGELOG.md | 231 - .../github.com/jackc/pgx/v5/CONTRIBUTING.md | 134 - vendor/github.com/jackc/pgx/v5/LICENSE | 22 - vendor/github.com/jackc/pgx/v5/README.md | 144 - vendor/github.com/jackc/pgx/v5/Rakefile | 18 - vendor/github.com/jackc/pgx/v5/batch.go | 435 - vendor/github.com/jackc/pgx/v5/conn.go | 1329 -- vendor/github.com/jackc/pgx/v5/copy_from.go | 214 - vendor/github.com/jackc/pgx/v5/doc.go | 192 - .../jackc/pgx/v5/extended_query_builder.go | 204 - .../jackc/pgx/v5/internal/anynil/anynil.go | 36 - .../pgx/v5/internal/iobufpool/iobufpool.go | 57 - .../pgx/v5/internal/nbconn/bufferqueue.go | 70 - .../jackc/pgx/v5/internal/nbconn/nbconn.go | 478 - .../internal/nbconn/nbconn_fake_non_block.go | 13 - .../internal/nbconn/nbconn_real_non_block.go | 70 - .../jackc/pgx/v5/internal/pgio/README.md | 6 - .../jackc/pgx/v5/internal/pgio/doc.go | 6 - .../jackc/pgx/v5/internal/pgio/write.go | 40 - .../pgx/v5/internal/sanitize/sanitize.go | 322 - .../pgx/v5/internal/stmtcache/lru_cache.go | 98 - .../pgx/v5/internal/stmtcache/stmtcache.go | 57 - .../v5/internal/stmtcache/unlimited_cache.go | 71 - .../github.com/jackc/pgx/v5/large_objects.go | 121 - vendor/github.com/jackc/pgx/v5/named_args.go | 266 - .../github.com/jackc/pgx/v5/pgconn/README.md | 29 - .../jackc/pgx/v5/pgconn/auth_scram.go | 272 - .../github.com/jackc/pgx/v5/pgconn/config.go | 886 -- .../jackc/pgx/v5/pgconn/defaults.go | 63 - .../jackc/pgx/v5/pgconn/defaults_windows.go | 57 - vendor/github.com/jackc/pgx/v5/pgconn/doc.go | 34 - .../github.com/jackc/pgx/v5/pgconn/errors.go | 226 - .../internal/ctxwatch/context_watcher.go | 73 - vendor/github.com/jackc/pgx/v5/pgconn/krb5.go | 100 - .../github.com/jackc/pgx/v5/pgconn/pgconn.go | 1962 --- .../jackc/pgx/v5/pgproto3/README.md | 7 - .../authentication_cleartext_password.go | 52 - .../pgx/v5/pgproto3/authentication_gss.go | 59 - .../pgproto3/authentication_gss_continue.go | 68 - .../pgproto3/authentication_md5_password.go | 77 - .../pgx/v5/pgproto3/authentication_ok.go | 52 - .../pgx/v5/pgproto3/authentication_sasl.go | 76 - .../pgproto3/authentication_sasl_continue.go | 81 - .../v5/pgproto3/authentication_sasl_final.go | 81 - .../jackc/pgx/v5/pgproto3/backend.go | 262 - .../jackc/pgx/v5/pgproto3/backend_key_data.go | 51 - .../jackc/pgx/v5/pgproto3/big_endian.go | 37 - .../github.com/jackc/pgx/v5/pgproto3/bind.go | 216 - .../jackc/pgx/v5/pgproto3/bind_complete.go | 34 - .../jackc/pgx/v5/pgproto3/cancel_request.go | 58 - .../jackc/pgx/v5/pgproto3/chunkreader.go | 90 - .../github.com/jackc/pgx/v5/pgproto3/close.go | 89 - .../jackc/pgx/v5/pgproto3/close_complete.go | 34 - .../jackc/pgx/v5/pgproto3/command_complete.go | 74 - .../pgx/v5/pgproto3/copy_both_response.go | 95 - .../jackc/pgx/v5/pgproto3/copy_data.go | 62 - .../jackc/pgx/v5/pgproto3/copy_done.go | 38 - .../jackc/pgx/v5/pgproto3/copy_fail.go | 53 - .../jackc/pgx/v5/pgproto3/copy_in_response.go | 96 - .../pgx/v5/pgproto3/copy_out_response.go | 96 - .../jackc/pgx/v5/pgproto3/data_row.go | 142 - .../jackc/pgx/v5/pgproto3/describe.go | 88 - .../github.com/jackc/pgx/v5/pgproto3/doc.go | 11 - .../pgx/v5/pgproto3/empty_query_response.go | 34 - .../jackc/pgx/v5/pgproto3/error_response.go | 333 - .../jackc/pgx/v5/pgproto3/execute.go | 65 - .../github.com/jackc/pgx/v5/pgproto3/flush.go | 34 - .../jackc/pgx/v5/pgproto3/frontend.go | 363 - .../jackc/pgx/v5/pgproto3/function_call.go | 95 - .../pgx/v5/pgproto3/function_call_response.go | 101 - .../jackc/pgx/v5/pgproto3/gss_enc_request.go | 49 - .../jackc/pgx/v5/pgproto3/gss_response.go | 49 - .../jackc/pgx/v5/pgproto3/no_data.go | 34 - .../jackc/pgx/v5/pgproto3/notice_response.go | 17 - .../pgx/v5/pgproto3/notification_response.go | 77 - .../pgx/v5/pgproto3/parameter_description.go | 66 - .../jackc/pgx/v5/pgproto3/parameter_status.go | 66 - .../github.com/jackc/pgx/v5/pgproto3/parse.go | 88 - .../jackc/pgx/v5/pgproto3/parse_complete.go | 34 - .../jackc/pgx/v5/pgproto3/password_message.go | 54 - .../jackc/pgx/v5/pgproto3/pgproto3.go | 85 - .../jackc/pgx/v5/pgproto3/portal_suspended.go | 34 - .../github.com/jackc/pgx/v5/pgproto3/query.go | 50 - .../jackc/pgx/v5/pgproto3/ready_for_query.go | 61 - .../jackc/pgx/v5/pgproto3/row_description.go | 165 - .../pgx/v5/pgproto3/sasl_initial_response.go | 94 - .../jackc/pgx/v5/pgproto3/sasl_response.go | 61 - .../jackc/pgx/v5/pgproto3/ssl_request.go | 49 - .../jackc/pgx/v5/pgproto3/startup_message.go | 96 - .../github.com/jackc/pgx/v5/pgproto3/sync.go | 34 - .../jackc/pgx/v5/pgproto3/terminate.go | 34 - .../github.com/jackc/pgx/v5/pgproto3/trace.go | 440 - .../github.com/jackc/pgx/v5/pgtype/array.go | 481 - .../jackc/pgx/v5/pgtype/array_codec.go | 395 - vendor/github.com/jackc/pgx/v5/pgtype/bits.go | 208 - vendor/github.com/jackc/pgx/v5/pgtype/bool.go | 317 - vendor/github.com/jackc/pgx/v5/pgtype/box.go | 238 - .../jackc/pgx/v5/pgtype/builtin_wrappers.go | 912 -- .../github.com/jackc/pgx/v5/pgtype/bytea.go | 255 - .../github.com/jackc/pgx/v5/pgtype/circle.go | 222 - .../jackc/pgx/v5/pgtype/composite.go | 602 - .../github.com/jackc/pgx/v5/pgtype/convert.go | 476 - vendor/github.com/jackc/pgx/v5/pgtype/date.go | 351 - vendor/github.com/jackc/pgx/v5/pgtype/doc.go | 151 - .../jackc/pgx/v5/pgtype/enum_codec.go | 109 - .../github.com/jackc/pgx/v5/pgtype/float4.go | 295 - .../github.com/jackc/pgx/v5/pgtype/float8.go | 349 - .../github.com/jackc/pgx/v5/pgtype/hstore.go | 461 - vendor/github.com/jackc/pgx/v5/pgtype/inet.go | 200 - vendor/github.com/jackc/pgx/v5/pgtype/int.go | 1980 --- .../github.com/jackc/pgx/v5/pgtype/int.go.erb | 547 - .../jackc/pgx/v5/pgtype/int_test.go.erb | 93 - .../pgtype/integration_benchmark_test.go.erb | 62 - .../pgtype/integration_benchmark_test_gen.sh | 2 - .../jackc/pgx/v5/pgtype/interval.go | 292 - vendor/github.com/jackc/pgx/v5/pgtype/json.go | 161 - .../github.com/jackc/pgx/v5/pgtype/jsonb.go | 127 - vendor/github.com/jackc/pgx/v5/pgtype/line.go | 225 - vendor/github.com/jackc/pgx/v5/pgtype/lseg.go | 238 - .../github.com/jackc/pgx/v5/pgtype/macaddr.go | 162 - .../jackc/pgx/v5/pgtype/multirange.go | 443 - .../github.com/jackc/pgx/v5/pgtype/numeric.go | 801 -- vendor/github.com/jackc/pgx/v5/pgtype/path.go | 272 - .../github.com/jackc/pgx/v5/pgtype/pgtype.go | 2024 --- .../github.com/jackc/pgx/v5/pgtype/point.go | 266 - .../github.com/jackc/pgx/v5/pgtype/polygon.go | 253 - .../github.com/jackc/pgx/v5/pgtype/qchar.go | 141 - .../github.com/jackc/pgx/v5/pgtype/range.go | 322 - .../jackc/pgx/v5/pgtype/range_codec.go | 379 - .../jackc/pgx/v5/pgtype/record_codec.go | 125 - .../v5/pgtype/register_default_pg_types.go | 35 - .../register_default_pg_types_disabled.go | 6 - vendor/github.com/jackc/pgx/v5/pgtype/text.go | 223 - .../pgx/v5/pgtype/text_format_only_codec.go | 13 - vendor/github.com/jackc/pgx/v5/pgtype/tid.go | 241 - vendor/github.com/jackc/pgx/v5/pgtype/time.go | 233 - .../jackc/pgx/v5/pgtype/timestamp.go | 295 - .../jackc/pgx/v5/pgtype/timestamptz.go | 355 - .../github.com/jackc/pgx/v5/pgtype/uint32.go | 303 - vendor/github.com/jackc/pgx/v5/pgtype/uuid.go | 269 - .../jackc/pgx/v5/pgxpool/batch_results.go | 52 - .../github.com/jackc/pgx/v5/pgxpool/conn.go | 130 - vendor/github.com/jackc/pgx/v5/pgxpool/doc.go | 28 - .../github.com/jackc/pgx/v5/pgxpool/pool.go | 688 - .../github.com/jackc/pgx/v5/pgxpool/rows.go | 109 - .../github.com/jackc/pgx/v5/pgxpool/stat.go | 84 - vendor/github.com/jackc/pgx/v5/pgxpool/tx.go | 82 - vendor/github.com/jackc/pgx/v5/rows.go | 649 - vendor/github.com/jackc/pgx/v5/tracer.go | 107 - vendor/github.com/jackc/pgx/v5/tx.go | 425 - vendor/github.com/jackc/pgx/v5/values.go | 68 - .../github.com/jackc/puddle/v2/CHANGELOG.md | 64 - vendor/github.com/jackc/puddle/v2/LICENSE | 22 - vendor/github.com/jackc/puddle/v2/README.md | 66 - vendor/github.com/jackc/puddle/v2/context.go | 24 - vendor/github.com/jackc/puddle/v2/doc.go | 11 - .../puddle/v2/internal/genstack/gen_stack.go | 85 - .../puddle/v2/internal/genstack/stack.go | 39 - vendor/github.com/jackc/puddle/v2/log.go | 32 - .../jackc/puddle/v2/nanotime_time.go | 13 - .../jackc/puddle/v2/nanotime_unsafe.go | 12 - vendor/github.com/jackc/puddle/v2/pool.go | 690 - .../jackc/puddle/v2/resource_list.go | 28 - .../github.com/jcchavezs/porto/.golangci.yml | 29 - vendor/github.com/jcchavezs/porto/LICENSE | 201 - vendor/github.com/jcchavezs/porto/Makefile | 22 - vendor/github.com/jcchavezs/porto/README.md | 50 - vendor/github.com/jcchavezs/porto/files.go | 49 - vendor/github.com/jcchavezs/porto/import.go | 280 - vendor/github.com/jcchavezs/porto/regexes.go | 33 - vendor/github.com/joeshaw/multierror/LICENSE | 21 - .../github.com/joeshaw/multierror/README.md | 54 - .../joeshaw/multierror/multierror.go | 47 - vendor/github.com/lann/builder/.gitignore | 2 - vendor/github.com/lann/builder/.travis.yml | 7 - vendor/github.com/lann/builder/LICENSE | 21 - vendor/github.com/lann/builder/README.md | 68 - vendor/github.com/lann/builder/builder.go | 225 - vendor/github.com/lann/builder/reflect.go | 24 - vendor/github.com/lann/builder/registry.go | 59 - vendor/github.com/lann/ps/LICENSE | 7 - vendor/github.com/lann/ps/README.md | 10 - vendor/github.com/lann/ps/list.go | 93 - vendor/github.com/lann/ps/map.go | 311 - vendor/github.com/lann/ps/profile.sh | 3 - vendor/github.com/pkg/errors/.gitignore | 24 - vendor/github.com/pkg/errors/.travis.yml | 10 - vendor/github.com/pkg/errors/LICENSE | 23 - vendor/github.com/pkg/errors/Makefile | 44 - vendor/github.com/pkg/errors/README.md | 59 - vendor/github.com/pkg/errors/appveyor.yml | 32 - vendor/github.com/pkg/errors/errors.go | 288 - vendor/github.com/pkg/errors/go113.go | 38 - vendor/github.com/pkg/errors/stack.go | 177 - .../github.com/prometheus/procfs/.gitignore | 2 - .../prometheus/procfs/.golangci.yml | 12 - .../prometheus/procfs/CODE_OF_CONDUCT.md | 3 - .../prometheus/procfs/CONTRIBUTING.md | 121 - vendor/github.com/prometheus/procfs/LICENSE | 201 - .../prometheus/procfs/MAINTAINERS.md | 2 - vendor/github.com/prometheus/procfs/Makefile | 31 - .../prometheus/procfs/Makefile.common | 267 - vendor/github.com/prometheus/procfs/NOTICE | 7 - vendor/github.com/prometheus/procfs/README.md | 61 - .../github.com/prometheus/procfs/SECURITY.md | 6 - vendor/github.com/prometheus/procfs/arp.go | 116 - .../github.com/prometheus/procfs/buddyinfo.go | 85 - .../github.com/prometheus/procfs/cmdline.go | 30 - .../github.com/prometheus/procfs/cpuinfo.go | 518 - .../prometheus/procfs/cpuinfo_armx.go | 20 - .../prometheus/procfs/cpuinfo_loong64.go | 19 - .../prometheus/procfs/cpuinfo_mipsx.go | 20 - .../prometheus/procfs/cpuinfo_others.go | 19 - .../prometheus/procfs/cpuinfo_ppcx.go | 20 - .../prometheus/procfs/cpuinfo_riscvx.go | 20 - .../prometheus/procfs/cpuinfo_s390x.go | 19 - .../prometheus/procfs/cpuinfo_x86.go | 20 - vendor/github.com/prometheus/procfs/crypto.go | 153 - vendor/github.com/prometheus/procfs/doc.go | 44 - vendor/github.com/prometheus/procfs/fs.go | 43 - .../github.com/prometheus/procfs/fscache.go | 422 - .../prometheus/procfs/internal/fs/fs.go | 55 - .../prometheus/procfs/internal/util/parse.go | 97 - .../procfs/internal/util/readfile.go | 37 - .../procfs/internal/util/sysreadfile.go | 50 - .../internal/util/sysreadfile_compat.go | 27 - .../procfs/internal/util/valueparser.go | 91 - vendor/github.com/prometheus/procfs/ipvs.go | 240 - .../prometheus/procfs/kernel_random.go | 63 - .../github.com/prometheus/procfs/loadavg.go | 62 - vendor/github.com/prometheus/procfs/mdstat.go | 266 - .../github.com/prometheus/procfs/meminfo.go | 277 - .../github.com/prometheus/procfs/mountinfo.go | 180 - .../prometheus/procfs/mountstats.go | 639 - .../prometheus/procfs/net_conntrackstat.go | 153 - .../github.com/prometheus/procfs/net_dev.go | 205 - .../prometheus/procfs/net_ip_socket.go | 226 - .../prometheus/procfs/net_protocols.go | 180 - .../prometheus/procfs/net_sockstat.go | 163 - .../prometheus/procfs/net_softnet.go | 150 - .../github.com/prometheus/procfs/net_tcp.go | 64 - .../github.com/prometheus/procfs/net_udp.go | 64 - .../github.com/prometheus/procfs/net_unix.go | 257 - .../github.com/prometheus/procfs/net_xfrm.go | 189 - .../github.com/prometheus/procfs/netstat.go | 85 - vendor/github.com/prometheus/procfs/proc.go | 319 - .../prometheus/procfs/proc_cgroup.go | 98 - .../prometheus/procfs/proc_cgroups.go | 98 - .../prometheus/procfs/proc_environ.go | 37 - .../prometheus/procfs/proc_fdinfo.go | 132 - .../prometheus/procfs/proc_interrupts.go | 98 - .../github.com/prometheus/procfs/proc_io.go | 59 - .../prometheus/procfs/proc_limits.go | 160 - .../github.com/prometheus/procfs/proc_maps.go | 211 - .../prometheus/procfs/proc_netstat.go | 443 - .../github.com/prometheus/procfs/proc_ns.go | 68 - .../github.com/prometheus/procfs/proc_psi.go | 102 - .../prometheus/procfs/proc_smaps.go | 166 - .../github.com/prometheus/procfs/proc_snmp.go | 353 - .../prometheus/procfs/proc_snmp6.go | 381 - .../github.com/prometheus/procfs/proc_stat.go | 224 - .../prometheus/procfs/proc_status.go | 170 - .../github.com/prometheus/procfs/proc_sys.go | 51 - .../github.com/prometheus/procfs/schedstat.go | 121 - vendor/github.com/prometheus/procfs/slab.go | 151 - .../github.com/prometheus/procfs/softirqs.go | 160 - vendor/github.com/prometheus/procfs/stat.go | 254 - vendor/github.com/prometheus/procfs/swaps.go | 89 - vendor/github.com/prometheus/procfs/thread.go | 79 - vendor/github.com/prometheus/procfs/ttar | 413 - vendor/github.com/prometheus/procfs/vm.go | 212 - .../github.com/prometheus/procfs/zoneinfo.go | 196 - .../github.com/redis/go-redis/v9/.gitignore | 3 - .../redis/go-redis/v9/.golangci.yml | 4 - .../redis/go-redis/v9/.prettierrc.yml | 4 - .../github.com/redis/go-redis/v9/CHANGELOG.md | 47 - vendor/github.com/redis/go-redis/v9/LICENSE | 25 - vendor/github.com/redis/go-redis/v9/Makefile | 40 - vendor/github.com/redis/go-redis/v9/README.md | 179 - .../github.com/redis/go-redis/v9/RELEASING.md | 15 - .../github.com/redis/go-redis/v9/cluster.go | 1898 --- .../redis/go-redis/v9/cluster_commands.go | 109 - .../github.com/redis/go-redis/v9/command.go | 3692 ------ .../github.com/redis/go-redis/v9/commands.go | 3504 ----- vendor/github.com/redis/go-redis/v9/doc.go | 4 - vendor/github.com/redis/go-redis/v9/error.go | 155 - .../redis/go-redis/v9/internal/arg.go | 58 - .../go-redis/v9/internal/hashtag/hashtag.go | 78 - .../redis/go-redis/v9/internal/hscan/hscan.go | 207 - .../go-redis/v9/internal/hscan/structmap.go | 115 - .../redis/go-redis/v9/internal/internal.go | 29 - .../redis/go-redis/v9/internal/log.go | 26 - .../redis/go-redis/v9/internal/once.go | 63 - .../redis/go-redis/v9/internal/pool/conn.go | 127 - .../go-redis/v9/internal/pool/conn_check.go | 50 - .../v9/internal/pool/conn_check_dummy.go | 10 - .../redis/go-redis/v9/internal/pool/pool.go | 502 - .../go-redis/v9/internal/pool/pool_single.go | 58 - .../go-redis/v9/internal/pool/pool_sticky.go | 201 - .../go-redis/v9/internal/proto/reader.go | 550 - .../redis/go-redis/v9/internal/proto/scan.go | 185 - .../go-redis/v9/internal/proto/writer.go | 158 - .../redis/go-redis/v9/internal/rand/rand.go | 50 - .../redis/go-redis/v9/internal/util.go | 46 - .../redis/go-redis/v9/internal/util/safe.go | 12 - .../go-redis/v9/internal/util/strconv.go | 19 - .../redis/go-redis/v9/internal/util/unsafe.go | 23 - .../github.com/redis/go-redis/v9/iterator.go | 66 - .../github.com/redis/go-redis/v9/options.go | 499 - .../github.com/redis/go-redis/v9/package.json | 8 - .../github.com/redis/go-redis/v9/pipeline.go | 105 - vendor/github.com/redis/go-redis/v9/pubsub.go | 729 -- vendor/github.com/redis/go-redis/v9/redis.go | 816 -- vendor/github.com/redis/go-redis/v9/result.go | 188 - vendor/github.com/redis/go-redis/v9/ring.go | 830 -- vendor/github.com/redis/go-redis/v9/script.go | 84 - .../github.com/redis/go-redis/v9/sentinel.go | 817 -- vendor/github.com/redis/go-redis/v9/tx.go | 151 - .../github.com/redis/go-redis/v9/universal.go | 227 - .../github.com/redis/go-redis/v9/version.go | 6 - .../santhosh-tekuri/jsonschema/.travis.yml | 10 - .../santhosh-tekuri/jsonschema/LICENSE | 27 - .../santhosh-tekuri/jsonschema/README.md | 148 - .../santhosh-tekuri/jsonschema/compiler.go | 534 - .../jsonschema/decoders/decoders.go | 32 - .../santhosh-tekuri/jsonschema/doc.go | 77 - .../santhosh-tekuri/jsonschema/draft4.go | 172 - .../santhosh-tekuri/jsonschema/draft6.go | 170 - .../santhosh-tekuri/jsonschema/draft7.go | 196 - .../santhosh-tekuri/jsonschema/errors.go | 122 - .../jsonschema/formats/formats.go | 295 - .../santhosh-tekuri/jsonschema/go.test.sh | 12 - .../jsonschema/loader/loader.go | 105 - .../jsonschema/mediatypes/mediatypes.go | 39 - .../santhosh-tekuri/jsonschema/resource.go | 236 - .../santhosh-tekuri/jsonschema/schema.go | 558 - vendor/go.elastic.co/apm/.dockerignore | 2 - vendor/go.elastic.co/apm/.gitignore | 6 - vendor/go.elastic.co/apm/.jenkins-edge.yml | 2 - vendor/go.elastic.co/apm/.jenkins.yml | 12 - vendor/go.elastic.co/apm/CHANGELOG.asciidoc | 370 - vendor/go.elastic.co/apm/CHANGELOG.md | 1 - vendor/go.elastic.co/apm/CODE_OF_CONDUCT.md | 3 - vendor/go.elastic.co/apm/CONTRIBUTING.md | 92 - vendor/go.elastic.co/apm/Jenkinsfile | 342 - vendor/go.elastic.co/apm/LICENSE | 201 - vendor/go.elastic.co/apm/Makefile | 92 - vendor/go.elastic.co/apm/NOTICE | 84 - vendor/go.elastic.co/apm/README.md | 39 - vendor/go.elastic.co/apm/SECURITY.md | 7 - vendor/go.elastic.co/apm/apmconfig/doc.go | 20 - vendor/go.elastic.co/apm/apmconfig/watcher.go | 54 - vendor/go.elastic.co/apm/breakdown.go | 365 - vendor/go.elastic.co/apm/builtin_metrics.go | 164 - vendor/go.elastic.co/apm/capturebody.go | 218 - vendor/go.elastic.co/apm/config.go | 624 - vendor/go.elastic.co/apm/context.go | 288 - vendor/go.elastic.co/apm/doc.go | 21 - vendor/go.elastic.co/apm/error.go | 742 -- vendor/go.elastic.co/apm/error_unix.go | 31 - vendor/go.elastic.co/apm/error_windows.go | 27 - vendor/go.elastic.co/apm/fmt.go | 85 - vendor/go.elastic.co/apm/fnv.go | 42 - vendor/go.elastic.co/apm/gocontext.go | 157 - vendor/go.elastic.co/apm/gofuzz.go | 267 - .../apm/internal/apmcloudutil/aws.go | 100 - .../apm/internal/apmcloudutil/azure.go | 129 - .../apm/internal/apmcloudutil/gcp.go | 106 - .../apm/internal/apmcloudutil/provider.go | 123 - .../apm/internal/apmcontext/context.go | 108 - .../apm/internal/apmhostutil/container.go | 34 - .../internal/apmhostutil/container_linux.go | 157 - .../apmhostutil/container_nonlinux.go | 37 - .../apm/internal/apmhttputil/forwarded.go | 74 - .../apm/internal/apmhttputil/remoteaddr.go | 60 - .../apm/internal/apmhttputil/url.go | 113 - .../apm/internal/apmlog/logger.go | 212 - .../apm/internal/apmmath/round_go10.go | 28 - .../apm/internal/apmmath/round_go9.go | 34 - .../apm/internal/apmschema/schema.go | 69 - .../apm/internal/apmschema/update.sh | 18 - .../apm/internal/apmstrings/concat10.go | 38 - .../apm/internal/apmstrings/concat9.go | 41 - .../apm/internal/apmstrings/truncate.go | 31 - .../apm/internal/apmversion/version.go | 23 - .../apm/internal/configutil/duration.go | 115 - .../apm/internal/configutil/env.go | 104 - .../apm/internal/configutil/list.go | 34 - .../apm/internal/configutil/size.go | 105 - .../apm/internal/configutil/wildcards.go | 62 - .../go.elastic.co/apm/internal/iochan/doc.go | 19 - .../apm/internal/iochan/reader.go | 110 - .../apm/internal/pkgerrorsutil/pkgerrors.go | 60 - .../apm/internal/ringbuffer/buffer.go | 142 - .../apm/internal/ringbuffer/doc.go | 22 - .../apm/internal/wildcard/doc.go | 19 - .../apm/internal/wildcard/matcher.go | 142 - .../apm/internal/wildcard/matchers.go | 31 - vendor/go.elastic.co/apm/logger.go | 54 - vendor/go.elastic.co/apm/metrics.go | 168 - vendor/go.elastic.co/apm/model/doc.go | 21 - vendor/go.elastic.co/apm/model/generate.sh | 5 - vendor/go.elastic.co/apm/model/gofuzz.go | 83 - vendor/go.elastic.co/apm/model/maps.go | 48 - vendor/go.elastic.co/apm/model/marshal.go | 706 - .../apm/model/marshal_fastjson.go | 1546 --- vendor/go.elastic.co/apm/model/model.go | 824 -- vendor/go.elastic.co/apm/modelwriter.go | 303 - .../go.elastic.co/apm/module/apmhttp/LICENSE | 201 - .../apm/module/apmhttp/client.go | 224 - .../apm/module/apmhttp/clienttrace.go | 148 - .../apm/module/apmhttp/context.go | 40 - .../go.elastic.co/apm/module/apmhttp/doc.go | 20 - .../apm/module/apmhttp/handler.go | 389 - .../apm/module/apmhttp/ignorer.go | 96 - .../apm/module/apmhttp/recovery.go | 60 - .../apm/module/apmhttp/requestname.go | 57 - .../apm/module/apmhttp/requestname_go19.go | 47 - .../apm/module/apmhttp/traceheaders.go | 168 - vendor/go.elastic.co/apm/profiling.go | 168 - vendor/go.elastic.co/apm/sampler.go | 132 - vendor/go.elastic.co/apm/sanitizer.go | 69 - vendor/go.elastic.co/apm/span.go | 590 - vendor/go.elastic.co/apm/span_compressed.go | 318 - vendor/go.elastic.co/apm/spancontext.go | 256 - vendor/go.elastic.co/apm/stacktrace.go | 52 - .../go.elastic.co/apm/stacktrace/context.go | 100 - vendor/go.elastic.co/apm/stacktrace/doc.go | 20 - vendor/go.elastic.co/apm/stacktrace/frame.go | 34 - .../apm/stacktrace/generate_library.bash | 77 - .../go.elastic.co/apm/stacktrace/library.go | 253 - .../apm/stacktrace/stacktrace.go | 162 - vendor/go.elastic.co/apm/tools.go | 29 - vendor/go.elastic.co/apm/tracecontext.go | 337 - vendor/go.elastic.co/apm/tracer.go | 1357 -- vendor/go.elastic.co/apm/tracer_stats.go | 70 - vendor/go.elastic.co/apm/transaction.go | 432 - vendor/go.elastic.co/apm/transport/api.go | 33 - vendor/go.elastic.co/apm/transport/default.go | 54 - vendor/go.elastic.co/apm/transport/discard.go | 31 - vendor/go.elastic.co/apm/transport/doc.go | 20 - vendor/go.elastic.co/apm/transport/http.go | 650 - vendor/go.elastic.co/apm/utils.go | 276 - vendor/go.elastic.co/apm/utils_linux.go | 40 - vendor/go.elastic.co/apm/utils_other.go | 39 - vendor/go.elastic.co/apm/version.go | 23 - vendor/go.elastic.co/fastjson/.travis.yml | 12 - vendor/go.elastic.co/fastjson/LICENSE | 23 - vendor/go.elastic.co/fastjson/README.md | 134 - vendor/go.elastic.co/fastjson/doc.go | 23 - vendor/go.elastic.co/fastjson/marshaler.go | 151 - vendor/go.elastic.co/fastjson/writer.go | 181 - vendor/go.uber.org/atomic/.codecov.yml | 19 - vendor/go.uber.org/atomic/.gitignore | 15 - vendor/go.uber.org/atomic/CHANGELOG.md | 117 - vendor/go.uber.org/atomic/LICENSE.txt | 19 - vendor/go.uber.org/atomic/Makefile | 79 - vendor/go.uber.org/atomic/README.md | 63 - vendor/go.uber.org/atomic/bool.go | 88 - vendor/go.uber.org/atomic/bool_ext.go | 53 - vendor/go.uber.org/atomic/doc.go | 23 - vendor/go.uber.org/atomic/duration.go | 89 - vendor/go.uber.org/atomic/duration_ext.go | 40 - vendor/go.uber.org/atomic/error.go | 62 - vendor/go.uber.org/atomic/error_ext.go | 39 - vendor/go.uber.org/atomic/float32.go | 77 - vendor/go.uber.org/atomic/float32_ext.go | 76 - vendor/go.uber.org/atomic/float64.go | 77 - vendor/go.uber.org/atomic/float64_ext.go | 76 - vendor/go.uber.org/atomic/gen.go | 27 - vendor/go.uber.org/atomic/int32.go | 109 - vendor/go.uber.org/atomic/int64.go | 109 - vendor/go.uber.org/atomic/nocmp.go | 35 - vendor/go.uber.org/atomic/pointer_go118.go | 60 - vendor/go.uber.org/atomic/pointer_go119.go | 61 - vendor/go.uber.org/atomic/string.go | 65 - vendor/go.uber.org/atomic/string_ext.go | 43 - vendor/go.uber.org/atomic/time.go | 55 - vendor/go.uber.org/atomic/time_ext.go | 36 - vendor/go.uber.org/atomic/uint32.go | 109 - vendor/go.uber.org/atomic/uint64.go | 109 - vendor/go.uber.org/atomic/uintptr.go | 109 - vendor/go.uber.org/atomic/unsafe_pointer.go | 65 - vendor/go.uber.org/atomic/value.go | 31 - vendor/golang.org/x/crypto/LICENSE | 27 - vendor/golang.org/x/crypto/PATENTS | 22 - vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go | 77 - vendor/golang.org/x/lint/.travis.yml | 19 - vendor/golang.org/x/lint/CONTRIBUTING.md | 15 - vendor/golang.org/x/lint/LICENSE | 27 - vendor/golang.org/x/lint/README.md | 93 - vendor/golang.org/x/lint/golint/golint.go | 159 - vendor/golang.org/x/lint/golint/import.go | 309 - .../golang.org/x/lint/golint/importcomment.go | 13 - vendor/golang.org/x/lint/lint.go | 1615 --- vendor/golang.org/x/mod/LICENSE | 27 - vendor/golang.org/x/mod/PATENTS | 22 - .../x/mod/internal/lazyregexp/lazyre.go | 78 - vendor/golang.org/x/mod/modfile/print.go | 174 - vendor/golang.org/x/mod/modfile/read.go | 958 -- vendor/golang.org/x/mod/modfile/rule.go | 1559 --- vendor/golang.org/x/mod/modfile/work.go | 234 - vendor/golang.org/x/mod/module/module.go | 841 -- vendor/golang.org/x/mod/module/pseudo.go | 250 - vendor/golang.org/x/mod/semver/semver.go | 401 - vendor/golang.org/x/sync/LICENSE | 27 - vendor/golang.org/x/sync/PATENTS | 22 - .../golang.org/x/sync/semaphore/semaphore.go | 136 - vendor/golang.org/x/sys/LICENSE | 27 - vendor/golang.org/x/sys/PATENTS | 22 - vendor/golang.org/x/sys/execabs/execabs.go | 102 - .../golang.org/x/sys/execabs/execabs_go118.go | 12 - .../golang.org/x/sys/execabs/execabs_go119.go | 17 - .../sys/internal/unsafeheader/unsafeheader.go | 30 - vendor/golang.org/x/sys/unix/.gitignore | 2 - vendor/golang.org/x/sys/unix/README.md | 184 - .../golang.org/x/sys/unix/affinity_linux.go | 86 - vendor/golang.org/x/sys/unix/aliases.go | 15 - vendor/golang.org/x/sys/unix/asm_aix_ppc64.s | 18 - vendor/golang.org/x/sys/unix/asm_bsd_386.s | 29 - vendor/golang.org/x/sys/unix/asm_bsd_amd64.s | 29 - vendor/golang.org/x/sys/unix/asm_bsd_arm.s | 29 - vendor/golang.org/x/sys/unix/asm_bsd_arm64.s | 29 - vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s | 31 - .../golang.org/x/sys/unix/asm_bsd_riscv64.s | 29 - vendor/golang.org/x/sys/unix/asm_linux_386.s | 66 - .../golang.org/x/sys/unix/asm_linux_amd64.s | 58 - vendor/golang.org/x/sys/unix/asm_linux_arm.s | 57 - .../golang.org/x/sys/unix/asm_linux_arm64.s | 53 - .../golang.org/x/sys/unix/asm_linux_loong64.s | 54 - .../golang.org/x/sys/unix/asm_linux_mips64x.s | 57 - .../golang.org/x/sys/unix/asm_linux_mipsx.s | 55 - .../golang.org/x/sys/unix/asm_linux_ppc64x.s | 45 - .../golang.org/x/sys/unix/asm_linux_riscv64.s | 49 - .../golang.org/x/sys/unix/asm_linux_s390x.s | 57 - .../x/sys/unix/asm_openbsd_mips64.s | 30 - .../golang.org/x/sys/unix/asm_solaris_amd64.s | 18 - vendor/golang.org/x/sys/unix/asm_zos_s390x.s | 426 - .../golang.org/x/sys/unix/bluetooth_linux.go | 36 - vendor/golang.org/x/sys/unix/cap_freebsd.go | 196 - vendor/golang.org/x/sys/unix/constants.go | 14 - vendor/golang.org/x/sys/unix/dev_aix_ppc.go | 27 - vendor/golang.org/x/sys/unix/dev_aix_ppc64.go | 29 - vendor/golang.org/x/sys/unix/dev_darwin.go | 24 - vendor/golang.org/x/sys/unix/dev_dragonfly.go | 30 - vendor/golang.org/x/sys/unix/dev_freebsd.go | 30 - vendor/golang.org/x/sys/unix/dev_linux.go | 42 - vendor/golang.org/x/sys/unix/dev_netbsd.go | 29 - vendor/golang.org/x/sys/unix/dev_openbsd.go | 29 - vendor/golang.org/x/sys/unix/dev_zos.go | 29 - vendor/golang.org/x/sys/unix/dirent.go | 103 - vendor/golang.org/x/sys/unix/endian_big.go | 10 - vendor/golang.org/x/sys/unix/endian_little.go | 10 - vendor/golang.org/x/sys/unix/env_unix.go | 32 - vendor/golang.org/x/sys/unix/epoll_zos.go | 221 - vendor/golang.org/x/sys/unix/fcntl.go | 37 - vendor/golang.org/x/sys/unix/fcntl_darwin.go | 24 - .../x/sys/unix/fcntl_linux_32bit.go | 14 - vendor/golang.org/x/sys/unix/fdset.go | 30 - vendor/golang.org/x/sys/unix/fstatfs_zos.go | 164 - vendor/golang.org/x/sys/unix/gccgo.go | 60 - vendor/golang.org/x/sys/unix/gccgo_c.c | 45 - .../x/sys/unix/gccgo_linux_amd64.go | 21 - vendor/golang.org/x/sys/unix/ifreq_linux.go | 142 - vendor/golang.org/x/sys/unix/ioctl.go | 75 - vendor/golang.org/x/sys/unix/ioctl_linux.go | 233 - vendor/golang.org/x/sys/unix/ioctl_zos.go | 74 - vendor/golang.org/x/sys/unix/mkall.sh | 249 - vendor/golang.org/x/sys/unix/mkerrors.sh | 778 -- vendor/golang.org/x/sys/unix/pagesize_unix.go | 16 - .../golang.org/x/sys/unix/pledge_openbsd.go | 163 - vendor/golang.org/x/sys/unix/ptrace_darwin.go | 12 - vendor/golang.org/x/sys/unix/ptrace_ios.go | 12 - vendor/golang.org/x/sys/unix/race.go | 31 - vendor/golang.org/x/sys/unix/race0.go | 26 - .../x/sys/unix/readdirent_getdents.go | 13 - .../x/sys/unix/readdirent_getdirentries.go | 20 - .../x/sys/unix/sockcmsg_dragonfly.go | 16 - .../golang.org/x/sys/unix/sockcmsg_linux.go | 85 - vendor/golang.org/x/sys/unix/sockcmsg_unix.go | 107 - .../x/sys/unix/sockcmsg_unix_other.go | 47 - vendor/golang.org/x/sys/unix/syscall.go | 87 - vendor/golang.org/x/sys/unix/syscall_aix.go | 600 - .../golang.org/x/sys/unix/syscall_aix_ppc.go | 54 - .../x/sys/unix/syscall_aix_ppc64.go | 85 - vendor/golang.org/x/sys/unix/syscall_bsd.go | 625 - .../golang.org/x/sys/unix/syscall_darwin.go | 830 -- .../x/sys/unix/syscall_darwin_amd64.go | 51 - .../x/sys/unix/syscall_darwin_arm64.go | 51 - .../x/sys/unix/syscall_darwin_libSystem.go | 27 - .../x/sys/unix/syscall_dragonfly.go | 545 - .../x/sys/unix/syscall_dragonfly_amd64.go | 57 - .../golang.org/x/sys/unix/syscall_freebsd.go | 615 - .../x/sys/unix/syscall_freebsd_386.go | 67 - .../x/sys/unix/syscall_freebsd_amd64.go | 67 - .../x/sys/unix/syscall_freebsd_arm.go | 63 - .../x/sys/unix/syscall_freebsd_arm64.go | 63 - .../x/sys/unix/syscall_freebsd_riscv64.go | 63 - vendor/golang.org/x/sys/unix/syscall_hurd.go | 22 - .../golang.org/x/sys/unix/syscall_hurd_386.go | 29 - .../golang.org/x/sys/unix/syscall_illumos.go | 79 - vendor/golang.org/x/sys/unix/syscall_linux.go | 2491 ---- .../x/sys/unix/syscall_linux_386.go | 342 - .../x/sys/unix/syscall_linux_alarm.go | 14 - .../x/sys/unix/syscall_linux_amd64.go | 147 - .../x/sys/unix/syscall_linux_amd64_gc.go | 13 - .../x/sys/unix/syscall_linux_arm.go | 244 - .../x/sys/unix/syscall_linux_arm64.go | 195 - .../golang.org/x/sys/unix/syscall_linux_gc.go | 15 - .../x/sys/unix/syscall_linux_gc_386.go | 17 - .../x/sys/unix/syscall_linux_gc_arm.go | 14 - .../x/sys/unix/syscall_linux_gccgo_386.go | 31 - .../x/sys/unix/syscall_linux_gccgo_arm.go | 21 - .../x/sys/unix/syscall_linux_loong64.go | 222 - .../x/sys/unix/syscall_linux_mips64x.go | 191 - .../x/sys/unix/syscall_linux_mipsx.go | 203 - .../x/sys/unix/syscall_linux_ppc.go | 232 - .../x/sys/unix/syscall_linux_ppc64x.go | 118 - .../x/sys/unix/syscall_linux_riscv64.go | 180 - .../x/sys/unix/syscall_linux_s390x.go | 298 - .../x/sys/unix/syscall_linux_sparc64.go | 114 - .../golang.org/x/sys/unix/syscall_netbsd.go | 624 - .../x/sys/unix/syscall_netbsd_386.go | 38 - .../x/sys/unix/syscall_netbsd_amd64.go | 38 - .../x/sys/unix/syscall_netbsd_arm.go | 38 - .../x/sys/unix/syscall_netbsd_arm64.go | 38 - .../golang.org/x/sys/unix/syscall_openbsd.go | 390 - .../x/sys/unix/syscall_openbsd_386.go | 42 - .../x/sys/unix/syscall_openbsd_amd64.go | 42 - .../x/sys/unix/syscall_openbsd_arm.go | 42 - .../x/sys/unix/syscall_openbsd_arm64.go | 42 - .../x/sys/unix/syscall_openbsd_libc.go | 27 - .../x/sys/unix/syscall_openbsd_mips64.go | 39 - .../x/sys/unix/syscall_openbsd_ppc64.go | 42 - .../x/sys/unix/syscall_openbsd_riscv64.go | 42 - .../golang.org/x/sys/unix/syscall_solaris.go | 1133 -- .../x/sys/unix/syscall_solaris_amd64.go | 28 - vendor/golang.org/x/sys/unix/syscall_unix.go | 589 - .../golang.org/x/sys/unix/syscall_unix_gc.go | 16 - .../x/sys/unix/syscall_unix_gc_ppc64x.go | 25 - .../x/sys/unix/syscall_zos_s390x.go | 1994 --- vendor/golang.org/x/sys/unix/sysvshm_linux.go | 21 - vendor/golang.org/x/sys/unix/sysvshm_unix.go | 52 - .../x/sys/unix/sysvshm_unix_other.go | 14 - vendor/golang.org/x/sys/unix/timestruct.go | 77 - .../golang.org/x/sys/unix/unveil_openbsd.go | 42 - vendor/golang.org/x/sys/unix/xattr_bsd.go | 276 - .../golang.org/x/sys/unix/zerrors_aix_ppc.go | 1385 -- .../x/sys/unix/zerrors_aix_ppc64.go | 1386 -- .../x/sys/unix/zerrors_darwin_amd64.go | 1892 --- .../x/sys/unix/zerrors_darwin_arm64.go | 1892 --- .../x/sys/unix/zerrors_dragonfly_amd64.go | 1738 --- .../x/sys/unix/zerrors_freebsd_386.go | 2043 --- .../x/sys/unix/zerrors_freebsd_amd64.go | 2040 --- .../x/sys/unix/zerrors_freebsd_arm.go | 2034 --- .../x/sys/unix/zerrors_freebsd_arm64.go | 2034 --- .../x/sys/unix/zerrors_freebsd_riscv64.go | 2148 --- vendor/golang.org/x/sys/unix/zerrors_linux.go | 3457 ----- .../x/sys/unix/zerrors_linux_386.go | 828 -- .../x/sys/unix/zerrors_linux_amd64.go | 828 -- .../x/sys/unix/zerrors_linux_arm.go | 834 -- .../x/sys/unix/zerrors_linux_arm64.go | 826 -- .../x/sys/unix/zerrors_linux_loong64.go | 818 -- .../x/sys/unix/zerrors_linux_mips.go | 835 -- .../x/sys/unix/zerrors_linux_mips64.go | 835 -- .../x/sys/unix/zerrors_linux_mips64le.go | 835 -- .../x/sys/unix/zerrors_linux_mipsle.go | 835 -- .../x/sys/unix/zerrors_linux_ppc.go | 887 -- .../x/sys/unix/zerrors_linux_ppc64.go | 891 -- .../x/sys/unix/zerrors_linux_ppc64le.go | 891 -- .../x/sys/unix/zerrors_linux_riscv64.go | 815 -- .../x/sys/unix/zerrors_linux_s390x.go | 890 -- .../x/sys/unix/zerrors_linux_sparc64.go | 885 -- .../x/sys/unix/zerrors_netbsd_386.go | 1780 --- .../x/sys/unix/zerrors_netbsd_amd64.go | 1770 --- .../x/sys/unix/zerrors_netbsd_arm.go | 1759 --- .../x/sys/unix/zerrors_netbsd_arm64.go | 1770 --- .../x/sys/unix/zerrors_openbsd_386.go | 1906 --- .../x/sys/unix/zerrors_openbsd_amd64.go | 1906 --- .../x/sys/unix/zerrors_openbsd_arm.go | 1906 --- .../x/sys/unix/zerrors_openbsd_arm64.go | 1906 --- .../x/sys/unix/zerrors_openbsd_mips64.go | 1906 --- .../x/sys/unix/zerrors_openbsd_ppc64.go | 1905 --- .../x/sys/unix/zerrors_openbsd_riscv64.go | 1904 --- .../x/sys/unix/zerrors_solaris_amd64.go | 1557 --- .../x/sys/unix/zerrors_zos_s390x.go | 860 -- .../x/sys/unix/zptrace_armnn_linux.go | 42 - .../x/sys/unix/zptrace_linux_arm64.go | 17 - .../x/sys/unix/zptrace_mipsnn_linux.go | 51 - .../x/sys/unix/zptrace_mipsnnle_linux.go | 51 - .../x/sys/unix/zptrace_x86_linux.go | 81 - .../golang.org/x/sys/unix/zsyscall_aix_ppc.go | 1485 --- .../x/sys/unix/zsyscall_aix_ppc64.go | 1443 -- .../x/sys/unix/zsyscall_aix_ppc64_gc.go | 1192 -- .../x/sys/unix/zsyscall_aix_ppc64_gccgo.go | 1070 -- .../x/sys/unix/zsyscall_darwin_amd64.go | 2545 ---- .../x/sys/unix/zsyscall_darwin_amd64.s | 904 -- .../x/sys/unix/zsyscall_darwin_arm64.go | 2545 ---- .../x/sys/unix/zsyscall_darwin_arm64.s | 904 -- .../x/sys/unix/zsyscall_dragonfly_amd64.go | 1689 --- .../x/sys/unix/zsyscall_freebsd_386.go | 1899 --- .../x/sys/unix/zsyscall_freebsd_amd64.go | 1899 --- .../x/sys/unix/zsyscall_freebsd_arm.go | 1899 --- .../x/sys/unix/zsyscall_freebsd_arm64.go | 1899 --- .../x/sys/unix/zsyscall_freebsd_riscv64.go | 1899 --- .../x/sys/unix/zsyscall_illumos_amd64.go | 102 - .../golang.org/x/sys/unix/zsyscall_linux.go | 2163 --- .../x/sys/unix/zsyscall_linux_386.go | 497 - .../x/sys/unix/zsyscall_linux_amd64.go | 664 - .../x/sys/unix/zsyscall_linux_arm.go | 612 - .../x/sys/unix/zsyscall_linux_arm64.go | 563 - .../x/sys/unix/zsyscall_linux_loong64.go | 487 - .../x/sys/unix/zsyscall_linux_mips.go | 664 - .../x/sys/unix/zsyscall_linux_mips64.go | 658 - .../x/sys/unix/zsyscall_linux_mips64le.go | 647 - .../x/sys/unix/zsyscall_linux_mipsle.go | 664 - .../x/sys/unix/zsyscall_linux_ppc.go | 669 - .../x/sys/unix/zsyscall_linux_ppc64.go | 715 - .../x/sys/unix/zsyscall_linux_ppc64le.go | 715 - .../x/sys/unix/zsyscall_linux_riscv64.go | 543 - .../x/sys/unix/zsyscall_linux_s390x.go | 506 - .../x/sys/unix/zsyscall_linux_sparc64.go | 659 - .../x/sys/unix/zsyscall_netbsd_386.go | 1860 --- .../x/sys/unix/zsyscall_netbsd_amd64.go | 1860 --- .../x/sys/unix/zsyscall_netbsd_arm.go | 1860 --- .../x/sys/unix/zsyscall_netbsd_arm64.go | 1860 --- .../x/sys/unix/zsyscall_openbsd_386.go | 2235 ---- .../x/sys/unix/zsyscall_openbsd_386.s | 669 - .../x/sys/unix/zsyscall_openbsd_amd64.go | 2235 ---- .../x/sys/unix/zsyscall_openbsd_amd64.s | 669 - .../x/sys/unix/zsyscall_openbsd_arm.go | 2235 ---- .../x/sys/unix/zsyscall_openbsd_arm.s | 669 - .../x/sys/unix/zsyscall_openbsd_arm64.go | 2235 ---- .../x/sys/unix/zsyscall_openbsd_arm64.s | 669 - .../x/sys/unix/zsyscall_openbsd_mips64.go | 2235 ---- .../x/sys/unix/zsyscall_openbsd_mips64.s | 669 - .../x/sys/unix/zsyscall_openbsd_ppc64.go | 2235 ---- .../x/sys/unix/zsyscall_openbsd_ppc64.s | 802 -- .../x/sys/unix/zsyscall_openbsd_riscv64.go | 2235 ---- .../x/sys/unix/zsyscall_openbsd_riscv64.s | 669 - .../x/sys/unix/zsyscall_solaris_amd64.go | 2106 --- .../x/sys/unix/zsyscall_zos_s390x.go | 1255 -- .../x/sys/unix/zsysctl_openbsd_386.go | 281 - .../x/sys/unix/zsysctl_openbsd_amd64.go | 281 - .../x/sys/unix/zsysctl_openbsd_arm.go | 281 - .../x/sys/unix/zsysctl_openbsd_arm64.go | 281 - .../x/sys/unix/zsysctl_openbsd_mips64.go | 281 - .../x/sys/unix/zsysctl_openbsd_ppc64.go | 281 - .../x/sys/unix/zsysctl_openbsd_riscv64.go | 282 - .../x/sys/unix/zsysnum_darwin_amd64.go | 440 - .../x/sys/unix/zsysnum_darwin_arm64.go | 438 - .../x/sys/unix/zsysnum_dragonfly_amd64.go | 317 - .../x/sys/unix/zsysnum_freebsd_386.go | 394 - .../x/sys/unix/zsysnum_freebsd_amd64.go | 394 - .../x/sys/unix/zsysnum_freebsd_arm.go | 394 - .../x/sys/unix/zsysnum_freebsd_arm64.go | 394 - .../x/sys/unix/zsysnum_freebsd_riscv64.go | 394 - .../x/sys/unix/zsysnum_linux_386.go | 450 - .../x/sys/unix/zsysnum_linux_amd64.go | 372 - .../x/sys/unix/zsysnum_linux_arm.go | 414 - .../x/sys/unix/zsysnum_linux_arm64.go | 317 - .../x/sys/unix/zsysnum_linux_loong64.go | 311 - .../x/sys/unix/zsysnum_linux_mips.go | 434 - .../x/sys/unix/zsysnum_linux_mips64.go | 364 - .../x/sys/unix/zsysnum_linux_mips64le.go | 364 - .../x/sys/unix/zsysnum_linux_mipsle.go | 434 - .../x/sys/unix/zsysnum_linux_ppc.go | 441 - .../x/sys/unix/zsysnum_linux_ppc64.go | 413 - .../x/sys/unix/zsysnum_linux_ppc64le.go | 413 - .../x/sys/unix/zsysnum_linux_riscv64.go | 316 - .../x/sys/unix/zsysnum_linux_s390x.go | 378 - .../x/sys/unix/zsysnum_linux_sparc64.go | 392 - .../x/sys/unix/zsysnum_netbsd_386.go | 275 - .../x/sys/unix/zsysnum_netbsd_amd64.go | 275 - .../x/sys/unix/zsysnum_netbsd_arm.go | 275 - .../x/sys/unix/zsysnum_netbsd_arm64.go | 275 - .../x/sys/unix/zsysnum_openbsd_386.go | 220 - .../x/sys/unix/zsysnum_openbsd_amd64.go | 220 - .../x/sys/unix/zsysnum_openbsd_arm.go | 220 - .../x/sys/unix/zsysnum_openbsd_arm64.go | 219 - .../x/sys/unix/zsysnum_openbsd_mips64.go | 222 - .../x/sys/unix/zsysnum_openbsd_ppc64.go | 218 - .../x/sys/unix/zsysnum_openbsd_riscv64.go | 219 - .../x/sys/unix/zsysnum_zos_s390x.go | 2670 ---- .../golang.org/x/sys/unix/ztypes_aix_ppc.go | 354 - .../golang.org/x/sys/unix/ztypes_aix_ppc64.go | 358 - .../x/sys/unix/ztypes_darwin_amd64.go | 795 -- .../x/sys/unix/ztypes_darwin_arm64.go | 795 -- .../x/sys/unix/ztypes_dragonfly_amd64.go | 474 - .../x/sys/unix/ztypes_freebsd_386.go | 651 - .../x/sys/unix/ztypes_freebsd_amd64.go | 656 - .../x/sys/unix/ztypes_freebsd_arm.go | 642 - .../x/sys/unix/ztypes_freebsd_arm64.go | 636 - .../x/sys/unix/ztypes_freebsd_riscv64.go | 638 - vendor/golang.org/x/sys/unix/ztypes_linux.go | 5609 -------- .../golang.org/x/sys/unix/ztypes_linux_386.go | 696 - .../x/sys/unix/ztypes_linux_amd64.go | 711 - .../golang.org/x/sys/unix/ztypes_linux_arm.go | 691 - .../x/sys/unix/ztypes_linux_arm64.go | 690 - .../x/sys/unix/ztypes_linux_loong64.go | 691 - .../x/sys/unix/ztypes_linux_mips.go | 696 - .../x/sys/unix/ztypes_linux_mips64.go | 693 - .../x/sys/unix/ztypes_linux_mips64le.go | 693 - .../x/sys/unix/ztypes_linux_mipsle.go | 696 - .../golang.org/x/sys/unix/ztypes_linux_ppc.go | 704 - .../x/sys/unix/ztypes_linux_ppc64.go | 699 - .../x/sys/unix/ztypes_linux_ppc64le.go | 699 - .../x/sys/unix/ztypes_linux_riscv64.go | 718 - .../x/sys/unix/ztypes_linux_s390x.go | 713 - .../x/sys/unix/ztypes_linux_sparc64.go | 694 - .../x/sys/unix/ztypes_netbsd_386.go | 586 - .../x/sys/unix/ztypes_netbsd_amd64.go | 594 - .../x/sys/unix/ztypes_netbsd_arm.go | 591 - .../x/sys/unix/ztypes_netbsd_arm64.go | 594 - .../x/sys/unix/ztypes_openbsd_386.go | 569 - .../x/sys/unix/ztypes_openbsd_amd64.go | 569 - .../x/sys/unix/ztypes_openbsd_arm.go | 576 - .../x/sys/unix/ztypes_openbsd_arm64.go | 569 - .../x/sys/unix/ztypes_openbsd_mips64.go | 569 - .../x/sys/unix/ztypes_openbsd_ppc64.go | 571 - .../x/sys/unix/ztypes_openbsd_riscv64.go | 571 - .../x/sys/unix/ztypes_solaris_amd64.go | 517 - .../golang.org/x/sys/unix/ztypes_zos_s390x.go | 415 - vendor/golang.org/x/sys/windows/aliases.go | 13 - .../golang.org/x/sys/windows/dll_windows.go | 416 - vendor/golang.org/x/sys/windows/empty.s | 9 - .../golang.org/x/sys/windows/env_windows.go | 54 - vendor/golang.org/x/sys/windows/eventlog.go | 21 - .../golang.org/x/sys/windows/exec_windows.go | 178 - .../x/sys/windows/memory_windows.go | 48 - vendor/golang.org/x/sys/windows/mkerrors.bash | 70 - .../x/sys/windows/mkknownfolderids.bash | 27 - vendor/golang.org/x/sys/windows/mksyscall.go | 10 - vendor/golang.org/x/sys/windows/race.go | 31 - vendor/golang.org/x/sys/windows/race0.go | 26 - .../golang.org/x/sys/windows/registry/key.go | 206 - .../x/sys/windows/registry/mksyscall.go | 10 - .../x/sys/windows/registry/syscall.go | 33 - .../x/sys/windows/registry/value.go | 387 - .../sys/windows/registry/zsyscall_windows.go | 117 - .../x/sys/windows/security_windows.go | 1444 -- vendor/golang.org/x/sys/windows/service.go | 247 - .../x/sys/windows/setupapi_windows.go | 1425 -- vendor/golang.org/x/sys/windows/str.go | 23 - vendor/golang.org/x/sys/windows/syscall.go | 105 - .../x/sys/windows/syscall_windows.go | 1816 --- .../golang.org/x/sys/windows/types_windows.go | 3260 ----- .../x/sys/windows/types_windows_386.go | 35 - .../x/sys/windows/types_windows_amd64.go | 34 - .../x/sys/windows/types_windows_arm.go | 35 - .../x/sys/windows/types_windows_arm64.go | 34 - .../x/sys/windows/zerrors_windows.go | 9468 ------------- .../x/sys/windows/zknownfolderids_windows.go | 149 - .../x/sys/windows/zsyscall_windows.go | 4309 ------ vendor/golang.org/x/text/LICENSE | 27 - vendor/golang.org/x/text/PATENTS | 22 - vendor/golang.org/x/text/cases/cases.go | 162 - vendor/golang.org/x/text/cases/context.go | 376 - vendor/golang.org/x/text/cases/fold.go | 34 - vendor/golang.org/x/text/cases/icu.go | 62 - vendor/golang.org/x/text/cases/info.go | 82 - vendor/golang.org/x/text/cases/map.go | 816 -- .../golang.org/x/text/cases/tables10.0.0.go | 2256 ---- .../golang.org/x/text/cases/tables11.0.0.go | 2317 ---- .../golang.org/x/text/cases/tables12.0.0.go | 2360 ---- .../golang.org/x/text/cases/tables13.0.0.go | 2400 ---- vendor/golang.org/x/text/cases/tables9.0.0.go | 2216 ---- vendor/golang.org/x/text/cases/trieval.go | 217 - vendor/golang.org/x/text/internal/internal.go | 49 - .../x/text/internal/language/common.go | 16 - .../x/text/internal/language/compact.go | 29 - .../text/internal/language/compact/compact.go | 61 - .../internal/language/compact/language.go | 260 - .../text/internal/language/compact/parents.go | 120 - .../text/internal/language/compact/tables.go | 1015 -- .../x/text/internal/language/compact/tags.go | 91 - .../x/text/internal/language/compose.go | 167 - .../x/text/internal/language/coverage.go | 28 - .../x/text/internal/language/language.go | 627 - .../x/text/internal/language/lookup.go | 412 - .../x/text/internal/language/match.go | 226 - .../x/text/internal/language/parse.go | 608 - .../x/text/internal/language/tables.go | 3472 ----- .../x/text/internal/language/tags.go | 48 - vendor/golang.org/x/text/internal/match.go | 67 - vendor/golang.org/x/text/internal/tag/tag.go | 100 - vendor/golang.org/x/text/language/coverage.go | 187 - vendor/golang.org/x/text/language/doc.go | 98 - vendor/golang.org/x/text/language/language.go | 605 - vendor/golang.org/x/text/language/match.go | 735 -- vendor/golang.org/x/text/language/parse.go | 256 - vendor/golang.org/x/text/language/tables.go | 298 - vendor/golang.org/x/text/language/tags.go | 145 - vendor/golang.org/x/text/runes/cond.go | 187 - vendor/golang.org/x/text/runes/runes.go | 355 - .../x/text/secure/bidirule/bidirule.go | 336 - .../x/text/secure/bidirule/bidirule10.0.0.go | 12 - .../x/text/secure/bidirule/bidirule9.0.0.go | 15 - .../golang.org/x/text/secure/precis/class.go | 36 - .../x/text/secure/precis/context.go | 139 - vendor/golang.org/x/text/secure/precis/doc.go | 14 - .../x/text/secure/precis/nickname.go | 72 - .../x/text/secure/precis/options.go | 157 - .../x/text/secure/precis/profile.go | 412 - .../x/text/secure/precis/profiles.go | 78 - .../x/text/secure/precis/tables10.0.0.go | 3890 ------ .../x/text/secure/precis/tables11.0.0.go | 4017 ------ .../x/text/secure/precis/tables12.0.0.go | 4119 ------ .../x/text/secure/precis/tables13.0.0.go | 4153 ------ .../x/text/secure/precis/tables9.0.0.go | 3791 ------ .../x/text/secure/precis/transformer.go | 32 - .../x/text/secure/precis/trieval.go | 64 - .../golang.org/x/text/transform/transform.go | 709 - vendor/golang.org/x/text/unicode/bidi/bidi.go | 359 - .../golang.org/x/text/unicode/bidi/bracket.go | 335 - vendor/golang.org/x/text/unicode/bidi/core.go | 1071 -- vendor/golang.org/x/text/unicode/bidi/prop.go | 206 - .../x/text/unicode/bidi/tables10.0.0.go | 1816 --- .../x/text/unicode/bidi/tables11.0.0.go | 1888 --- .../x/text/unicode/bidi/tables12.0.0.go | 1924 --- .../x/text/unicode/bidi/tables13.0.0.go | 1956 --- .../x/text/unicode/bidi/tables9.0.0.go | 1782 --- .../golang.org/x/text/unicode/bidi/trieval.go | 48 - .../x/text/unicode/norm/composition.go | 512 - .../x/text/unicode/norm/forminfo.go | 279 - .../golang.org/x/text/unicode/norm/input.go | 109 - vendor/golang.org/x/text/unicode/norm/iter.go | 458 - .../x/text/unicode/norm/normalize.go | 610 - .../x/text/unicode/norm/readwriter.go | 125 - .../x/text/unicode/norm/tables10.0.0.go | 7658 ----------- .../x/text/unicode/norm/tables11.0.0.go | 7694 ----------- .../x/text/unicode/norm/tables12.0.0.go | 7711 ----------- .../x/text/unicode/norm/tables13.0.0.go | 7761 ----------- .../x/text/unicode/norm/tables9.0.0.go | 7638 ----------- .../x/text/unicode/norm/transform.go | 88 - vendor/golang.org/x/text/unicode/norm/trie.go | 54 - vendor/golang.org/x/text/width/kind_string.go | 28 - .../golang.org/x/text/width/tables10.0.0.go | 1329 -- .../golang.org/x/text/width/tables11.0.0.go | 1341 -- .../golang.org/x/text/width/tables12.0.0.go | 1361 -- .../golang.org/x/text/width/tables13.0.0.go | 1362 -- vendor/golang.org/x/text/width/tables9.0.0.go | 1297 -- vendor/golang.org/x/text/width/transform.go | 239 - vendor/golang.org/x/text/width/trieval.go | 30 - vendor/golang.org/x/text/width/width.go | 206 - vendor/golang.org/x/tools/LICENSE | 27 - vendor/golang.org/x/tools/PATENTS | 22 - .../golang.org/x/tools/cmd/goimports/doc.go | 50 - .../x/tools/cmd/goimports/goimports.go | 380 - .../x/tools/cmd/goimports/goimports_gc.go | 27 - .../x/tools/cmd/goimports/goimports_not_gc.go | 12 - .../x/tools/go/ast/astutil/enclosing.go | 636 - .../x/tools/go/ast/astutil/imports.go | 485 - .../x/tools/go/ast/astutil/rewrite.go | 488 - .../golang.org/x/tools/go/ast/astutil/util.go | 18 - .../x/tools/go/gcexportdata/gcexportdata.go | 187 - .../x/tools/go/gcexportdata/importer.go | 75 - .../x/tools/internal/event/core/event.go | 85 - .../x/tools/internal/event/core/export.go | 70 - .../x/tools/internal/event/core/fast.go | 77 - .../golang.org/x/tools/internal/event/doc.go | 7 - .../x/tools/internal/event/event.go | 127 - .../x/tools/internal/event/keys/keys.go | 564 - .../x/tools/internal/event/keys/standard.go | 22 - .../x/tools/internal/event/label/label.go | 215 - .../x/tools/internal/fastwalk/fastwalk.go | 196 - .../internal/fastwalk/fastwalk_darwin.go | 119 - .../fastwalk/fastwalk_dirent_fileno.go | 14 - .../internal/fastwalk/fastwalk_dirent_ino.go | 15 - .../fastwalk/fastwalk_dirent_namlen_bsd.go | 14 - .../fastwalk/fastwalk_dirent_namlen_linux.go | 29 - .../internal/fastwalk/fastwalk_portable.go | 38 - .../tools/internal/fastwalk/fastwalk_unix.go | 153 - .../x/tools/internal/gcimporter/bexport.go | 852 -- .../x/tools/internal/gcimporter/bimport.go | 1053 -- .../x/tools/internal/gcimporter/exportdata.go | 99 - .../x/tools/internal/gcimporter/gcimporter.go | 265 - .../x/tools/internal/gcimporter/iexport.go | 1056 -- .../x/tools/internal/gcimporter/iimport.go | 898 -- .../internal/gcimporter/newInterface10.go | 22 - .../internal/gcimporter/newInterface11.go | 14 - .../internal/gcimporter/support_go117.go | 16 - .../internal/gcimporter/support_go118.go | 37 - .../x/tools/internal/gcimporter/unified_no.go | 10 - .../tools/internal/gcimporter/unified_yes.go | 10 - .../x/tools/internal/gcimporter/ureader_no.go | 19 - .../tools/internal/gcimporter/ureader_yes.go | 738 -- .../x/tools/internal/gocommand/invoke.go | 356 - .../x/tools/internal/gocommand/vendor.go | 109 - .../x/tools/internal/gocommand/version.go | 81 - .../x/tools/internal/gopathwalk/walk.go | 254 - .../x/tools/internal/imports/fix.go | 1738 --- .../x/tools/internal/imports/imports.go | 351 - .../x/tools/internal/imports/mod.go | 716 - .../x/tools/internal/imports/mod_cache.go | 236 - .../x/tools/internal/imports/sortimports.go | 297 - .../x/tools/internal/imports/zstdlib.go | 10929 ---------------- .../x/tools/internal/pkgbits/codes.go | 77 - .../x/tools/internal/pkgbits/decoder.go | 517 - .../x/tools/internal/pkgbits/doc.go | 32 - .../x/tools/internal/pkgbits/encoder.go | 383 - .../x/tools/internal/pkgbits/flags.go | 9 - .../x/tools/internal/pkgbits/frames_go1.go | 21 - .../x/tools/internal/pkgbits/frames_go17.go | 28 - .../x/tools/internal/pkgbits/reloc.go | 42 - .../x/tools/internal/pkgbits/support.go | 17 - .../x/tools/internal/pkgbits/sync.go | 113 - .../internal/pkgbits/syncmarker_string.go | 89 - .../x/tools/internal/typeparams/common.go | 179 - .../x/tools/internal/typeparams/coretype.go | 122 - .../internal/typeparams/enabled_go117.go | 12 - .../internal/typeparams/enabled_go118.go | 15 - .../x/tools/internal/typeparams/normalize.go | 218 - .../x/tools/internal/typeparams/termlist.go | 163 - .../internal/typeparams/typeparams_go117.go | 197 - .../internal/typeparams/typeparams_go118.go | 151 - .../x/tools/internal/typeparams/typeterm.go | 170 - vendor/howett.net/plist/.gitignore | 16 - vendor/howett.net/plist/.gitlab-ci.yml | 39 - vendor/howett.net/plist/LICENSE | 58 - vendor/howett.net/plist/README.md | 21 - vendor/howett.net/plist/bplist.go | 26 - vendor/howett.net/plist/bplist_generator.go | 303 - vendor/howett.net/plist/bplist_parser.go | 353 - vendor/howett.net/plist/decode.go | 119 - vendor/howett.net/plist/doc.go | 5 - vendor/howett.net/plist/encode.go | 126 - vendor/howett.net/plist/fuzz.go | 17 - vendor/howett.net/plist/marshal.go | 187 - vendor/howett.net/plist/must.go | 50 - vendor/howett.net/plist/plist.go | 83 - vendor/howett.net/plist/plist_types.go | 172 - vendor/howett.net/plist/text_generator.go | 228 - vendor/howett.net/plist/text_parser.go | 580 - vendor/howett.net/plist/text_tables.go | 61 - vendor/howett.net/plist/typeinfo.go | 170 - vendor/howett.net/plist/unmarshal.go | 331 - vendor/howett.net/plist/util.go | 25 - vendor/howett.net/plist/xml_generator.go | 178 - vendor/howett.net/plist/xml_parser.go | 211 - vendor/howett.net/plist/zerocopy.go | 20 - vendor/howett.net/plist/zerocopy_appengine.go | 7 - vendor/modules.txt | 184 - 1245 files changed, 1343 insertions(+), 460503 deletions(-) create mode 100644 cmd/booking/list create mode 100644 cmd/booking/main.go create mode 100644 cmd/server/grpc/grpc.go rename {internal => cmd}/server/http/handlers.go (93%) rename {internal => cmd}/server/http/handlers_users.go (90%) create mode 100644 cmd/server/http/http.go create mode 100644 cmd/server/http/web/templates/index.html create mode 100644 cmd/subscribers/kafka/kafka.go delete mode 100644 internal/notes/notes.go create mode 100644 internal/pkg/apm/apm.go create mode 100644 internal/pkg/apm/grpc_util.go create mode 100644 internal/pkg/apm/http.go create mode 100644 internal/pkg/apm/meter.go create mode 100644 internal/pkg/apm/prometheus.go create mode 100644 internal/pkg/apm/tracer.go delete mode 100644 internal/pkg/cachestore/cachestore.go rename internal/pkg/{datastore/datastore.go => postgres/postgres.go} (98%) create mode 100644 internal/pkg/sysignals/sysignals.go delete mode 100644 internal/server/http/http.go delete mode 100644 internal/server/http/web/templates/index.html delete mode 100644 internal/users/cache.go delete mode 100644 internal/users/store.go delete mode 100644 internal/users/users_test.go delete mode 100755 makeitmine.sh delete mode 100644 vendor/github.com/Masterminds/squirrel/.gitignore delete mode 100644 vendor/github.com/Masterminds/squirrel/.travis.yml delete mode 100644 vendor/github.com/Masterminds/squirrel/LICENSE.txt delete mode 100644 vendor/github.com/Masterminds/squirrel/README.md delete mode 100644 vendor/github.com/Masterminds/squirrel/case.go delete mode 100644 vendor/github.com/Masterminds/squirrel/delete.go delete mode 100644 vendor/github.com/Masterminds/squirrel/delete_ctx.go delete mode 100644 vendor/github.com/Masterminds/squirrel/expr.go delete mode 100644 vendor/github.com/Masterminds/squirrel/insert.go delete mode 100644 vendor/github.com/Masterminds/squirrel/insert_ctx.go delete mode 100644 vendor/github.com/Masterminds/squirrel/part.go delete mode 100644 vendor/github.com/Masterminds/squirrel/placeholder.go delete mode 100644 vendor/github.com/Masterminds/squirrel/row.go delete mode 100644 vendor/github.com/Masterminds/squirrel/select.go delete mode 100644 vendor/github.com/Masterminds/squirrel/select_ctx.go delete mode 100644 vendor/github.com/Masterminds/squirrel/squirrel.go delete mode 100644 vendor/github.com/Masterminds/squirrel/squirrel_ctx.go delete mode 100644 vendor/github.com/Masterminds/squirrel/statement.go delete mode 100644 vendor/github.com/Masterminds/squirrel/stmtcacher.go delete mode 100644 vendor/github.com/Masterminds/squirrel/stmtcacher_ctx.go delete mode 100644 vendor/github.com/Masterminds/squirrel/stmtcacher_noctx.go delete mode 100644 vendor/github.com/Masterminds/squirrel/update.go delete mode 100644 vendor/github.com/Masterminds/squirrel/update_ctx.go delete mode 100644 vendor/github.com/Masterminds/squirrel/where.go delete mode 100644 vendor/github.com/armon/go-radix/.gitignore delete mode 100644 vendor/github.com/armon/go-radix/.travis.yml delete mode 100644 vendor/github.com/armon/go-radix/LICENSE delete mode 100644 vendor/github.com/armon/go-radix/README.md delete mode 100644 vendor/github.com/armon/go-radix/radix.go delete mode 100644 vendor/github.com/bnkamalesh/errors/.gitignore delete mode 100644 vendor/github.com/bnkamalesh/errors/.travis.yml delete mode 100644 vendor/github.com/bnkamalesh/errors/LICENSE delete mode 100644 vendor/github.com/bnkamalesh/errors/README.md delete mode 100644 vendor/github.com/bnkamalesh/errors/errors.go delete mode 100644 vendor/github.com/bnkamalesh/errors/helper.go delete mode 100644 vendor/github.com/bnkamalesh/errors/mirror.go delete mode 100644 vendor/github.com/bnkamalesh/webgo/v6/.gitignore delete mode 100644 vendor/github.com/bnkamalesh/webgo/v6/CODE_OF_CONDUCT.md delete mode 100644 vendor/github.com/bnkamalesh/webgo/v6/CONTRIBUTING.md delete mode 100644 vendor/github.com/bnkamalesh/webgo/v6/LICENSE delete mode 100644 vendor/github.com/bnkamalesh/webgo/v6/README.md delete mode 100644 vendor/github.com/bnkamalesh/webgo/v6/_config.yml delete mode 100644 vendor/github.com/bnkamalesh/webgo/v6/config.go delete mode 100644 vendor/github.com/bnkamalesh/webgo/v6/errors.go delete mode 100644 vendor/github.com/bnkamalesh/webgo/v6/middleware/accesslog/accesslog.go delete mode 100644 vendor/github.com/bnkamalesh/webgo/v6/responses.go delete mode 100644 vendor/github.com/bnkamalesh/webgo/v6/route.go delete mode 100644 vendor/github.com/bnkamalesh/webgo/v6/router.go delete mode 100644 vendor/github.com/bnkamalesh/webgo/v6/webgo.go delete mode 100644 vendor/github.com/cespare/xxhash/v2/LICENSE.txt delete mode 100644 vendor/github.com/cespare/xxhash/v2/README.md delete mode 100644 vendor/github.com/cespare/xxhash/v2/testall.sh delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash.go delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_arm64.s delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_asm.go delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_other.go delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_safe.go delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go delete mode 100644 vendor/github.com/dgryski/go-rendezvous/LICENSE delete mode 100644 vendor/github.com/dgryski/go-rendezvous/rdv.go delete mode 100644 vendor/github.com/elastic/go-licenser/.gitignore delete mode 100644 vendor/github.com/elastic/go-licenser/.goreleaser.yml delete mode 100644 vendor/github.com/elastic/go-licenser/CONTRIBUTING.md delete mode 100644 vendor/github.com/elastic/go-licenser/LICENSE delete mode 100644 vendor/github.com/elastic/go-licenser/Makefile delete mode 100644 vendor/github.com/elastic/go-licenser/NOTICE delete mode 100644 vendor/github.com/elastic/go-licenser/README.md delete mode 100644 vendor/github.com/elastic/go-licenser/appveyor.yml delete mode 100644 vendor/github.com/elastic/go-licenser/error.go delete mode 100644 vendor/github.com/elastic/go-licenser/licensing/doc.go delete mode 100644 vendor/github.com/elastic/go-licenser/licensing/license.go delete mode 100644 vendor/github.com/elastic/go-licenser/main.go delete mode 100644 vendor/github.com/elastic/go-licenser/path.go delete mode 100644 vendor/github.com/elastic/go-licenser/testhelpers.go delete mode 100644 vendor/github.com/elastic/go-licenser/version.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/.editorconfig delete mode 100644 vendor/github.com/elastic/go-sysinfo/.gitattributes delete mode 100644 vendor/github.com/elastic/go-sysinfo/.gitignore delete mode 100644 vendor/github.com/elastic/go-sysinfo/CHANGELOG.md delete mode 100644 vendor/github.com/elastic/go-sysinfo/LICENSE.txt delete mode 100644 vendor/github.com/elastic/go-sysinfo/Makefile delete mode 100644 vendor/github.com/elastic/go-sysinfo/NOTICE.txt delete mode 100644 vendor/github.com/elastic/go-sysinfo/README.md delete mode 100644 vendor/github.com/elastic/go-sysinfo/internal/registry/registry.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/aix/boottime_aix_ppc64.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/aix/doc.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/aix/host_aix_ppc64.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/aix/kernel_aix_ppc64.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/aix/machineid_aix_ppc64.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/aix/os_aix_ppc64.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/aix/process_aix_ppc64.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/aix/ztypes_aix_ppc64.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/darwin/arch_darwin.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/darwin/boottime_darwin.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/darwin/doc.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/darwin/host_darwin.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/darwin/kernel_darwin.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/darwin/load_average_darwin.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/darwin/machineid_darwin.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/darwin/machineid_nocgo_darwin.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/darwin/memory_darwin.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/darwin/os.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/darwin/process_cgo_darwin.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/darwin/process_darwin.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/darwin/process_nocgo_darwin.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/darwin/syscall_cgo_darwin.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/darwin/syscall_darwin.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/darwin/syscall_nocgo_darwin.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/darwin/ztypes_darwin.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/linux/arch_linux.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/linux/boottime_linux.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/linux/capabilities_linux.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/linux/container.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/linux/doc.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/linux/host_linux.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/linux/kernel_linux.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/linux/machineid.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/linux/memory_linux.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/linux/os.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/linux/process_linux.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/linux/procnet.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/linux/seccomp_linux.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/linux/util.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/linux/vmstat.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/shared/network.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/windows/arch_windows.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/windows/boottime_windows.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/windows/device_windows.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/windows/doc.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/windows/helpers_windows.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/windows/host_windows.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/windows/kernel_windows.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/windows/machineid_windows.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/windows/os_windows.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/providers/windows/process_windows.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/system.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/types/errors.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/types/go.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/types/host.go delete mode 100644 vendor/github.com/elastic/go-sysinfo/types/process.go delete mode 100644 vendor/github.com/elastic/go-windows/.appveyor.yml delete mode 100644 vendor/github.com/elastic/go-windows/.gitattributes delete mode 100644 vendor/github.com/elastic/go-windows/.gitignore delete mode 100644 vendor/github.com/elastic/go-windows/.travis.yml delete mode 100644 vendor/github.com/elastic/go-windows/CHANGELOG.md delete mode 100644 vendor/github.com/elastic/go-windows/LICENSE.txt delete mode 100644 vendor/github.com/elastic/go-windows/NOTICE.txt delete mode 100644 vendor/github.com/elastic/go-windows/README.md delete mode 100644 vendor/github.com/elastic/go-windows/Vagrantfile delete mode 100644 vendor/github.com/elastic/go-windows/constants.go delete mode 100644 vendor/github.com/elastic/go-windows/doc.go delete mode 100644 vendor/github.com/elastic/go-windows/kernel32.go delete mode 100644 vendor/github.com/elastic/go-windows/ntdll.go delete mode 100644 vendor/github.com/elastic/go-windows/psapi.go delete mode 100644 vendor/github.com/elastic/go-windows/utf16.go delete mode 100644 vendor/github.com/elastic/go-windows/version.go delete mode 100644 vendor/github.com/elastic/go-windows/zsyscall_windows.go delete mode 100644 vendor/github.com/jackc/pgpassfile/.travis.yml delete mode 100644 vendor/github.com/jackc/pgpassfile/LICENSE delete mode 100644 vendor/github.com/jackc/pgpassfile/README.md delete mode 100644 vendor/github.com/jackc/pgpassfile/pgpass.go delete mode 100644 vendor/github.com/jackc/pgservicefile/.travis.yml delete mode 100644 vendor/github.com/jackc/pgservicefile/LICENSE delete mode 100644 vendor/github.com/jackc/pgservicefile/README.md delete mode 100644 vendor/github.com/jackc/pgservicefile/pgservicefile.go delete mode 100644 vendor/github.com/jackc/pgx/v5/.gitignore delete mode 100644 vendor/github.com/jackc/pgx/v5/CHANGELOG.md delete mode 100644 vendor/github.com/jackc/pgx/v5/CONTRIBUTING.md delete mode 100644 vendor/github.com/jackc/pgx/v5/LICENSE delete mode 100644 vendor/github.com/jackc/pgx/v5/README.md delete mode 100644 vendor/github.com/jackc/pgx/v5/Rakefile delete mode 100644 vendor/github.com/jackc/pgx/v5/batch.go delete mode 100644 vendor/github.com/jackc/pgx/v5/conn.go delete mode 100644 vendor/github.com/jackc/pgx/v5/copy_from.go delete mode 100644 vendor/github.com/jackc/pgx/v5/doc.go delete mode 100644 vendor/github.com/jackc/pgx/v5/extended_query_builder.go delete mode 100644 vendor/github.com/jackc/pgx/v5/internal/anynil/anynil.go delete mode 100644 vendor/github.com/jackc/pgx/v5/internal/iobufpool/iobufpool.go delete mode 100644 vendor/github.com/jackc/pgx/v5/internal/nbconn/bufferqueue.go delete mode 100644 vendor/github.com/jackc/pgx/v5/internal/nbconn/nbconn.go delete mode 100644 vendor/github.com/jackc/pgx/v5/internal/nbconn/nbconn_fake_non_block.go delete mode 100644 vendor/github.com/jackc/pgx/v5/internal/nbconn/nbconn_real_non_block.go delete mode 100644 vendor/github.com/jackc/pgx/v5/internal/pgio/README.md delete mode 100644 vendor/github.com/jackc/pgx/v5/internal/pgio/doc.go delete mode 100644 vendor/github.com/jackc/pgx/v5/internal/pgio/write.go delete mode 100644 vendor/github.com/jackc/pgx/v5/internal/sanitize/sanitize.go delete mode 100644 vendor/github.com/jackc/pgx/v5/internal/stmtcache/lru_cache.go delete mode 100644 vendor/github.com/jackc/pgx/v5/internal/stmtcache/stmtcache.go delete mode 100644 vendor/github.com/jackc/pgx/v5/internal/stmtcache/unlimited_cache.go delete mode 100644 vendor/github.com/jackc/pgx/v5/large_objects.go delete mode 100644 vendor/github.com/jackc/pgx/v5/named_args.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgconn/README.md delete mode 100644 vendor/github.com/jackc/pgx/v5/pgconn/auth_scram.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgconn/config.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgconn/defaults.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgconn/defaults_windows.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgconn/doc.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgconn/errors.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgconn/internal/ctxwatch/context_watcher.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgconn/krb5.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgconn/pgconn.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/README.md delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/authentication_cleartext_password.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/authentication_gss.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/authentication_gss_continue.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/authentication_md5_password.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/authentication_ok.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/authentication_sasl.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/authentication_sasl_continue.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/authentication_sasl_final.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/backend.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/backend_key_data.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/big_endian.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/bind.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/bind_complete.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/cancel_request.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/chunkreader.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/close.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/close_complete.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/command_complete.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/copy_both_response.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/copy_data.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/copy_done.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/copy_fail.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/copy_in_response.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/copy_out_response.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/data_row.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/describe.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/doc.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/empty_query_response.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/error_response.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/execute.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/flush.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/frontend.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/function_call.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/function_call_response.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/gss_enc_request.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/gss_response.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/no_data.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/notice_response.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/notification_response.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/parameter_description.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/parameter_status.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/parse.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/parse_complete.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/password_message.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/pgproto3.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/portal_suspended.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/query.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/ready_for_query.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/row_description.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/sasl_initial_response.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/sasl_response.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/ssl_request.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/startup_message.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/sync.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/terminate.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgproto3/trace.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/array.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/array_codec.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/bits.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/bool.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/box.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/builtin_wrappers.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/bytea.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/circle.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/composite.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/convert.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/date.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/doc.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/enum_codec.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/float4.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/float8.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/hstore.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/inet.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/int.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/int.go.erb delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/int_test.go.erb delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/integration_benchmark_test.go.erb delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/integration_benchmark_test_gen.sh delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/interval.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/json.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/jsonb.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/line.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/lseg.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/macaddr.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/multirange.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/numeric.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/path.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/pgtype.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/point.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/polygon.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/qchar.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/range.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/range_codec.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/record_codec.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/register_default_pg_types.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/register_default_pg_types_disabled.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/text.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/text_format_only_codec.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/tid.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/time.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/timestamp.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/timestamptz.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/uint32.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgtype/uuid.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgxpool/batch_results.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgxpool/conn.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgxpool/doc.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgxpool/pool.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgxpool/rows.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgxpool/stat.go delete mode 100644 vendor/github.com/jackc/pgx/v5/pgxpool/tx.go delete mode 100644 vendor/github.com/jackc/pgx/v5/rows.go delete mode 100644 vendor/github.com/jackc/pgx/v5/tracer.go delete mode 100644 vendor/github.com/jackc/pgx/v5/tx.go delete mode 100644 vendor/github.com/jackc/pgx/v5/values.go delete mode 100644 vendor/github.com/jackc/puddle/v2/CHANGELOG.md delete mode 100644 vendor/github.com/jackc/puddle/v2/LICENSE delete mode 100644 vendor/github.com/jackc/puddle/v2/README.md delete mode 100644 vendor/github.com/jackc/puddle/v2/context.go delete mode 100644 vendor/github.com/jackc/puddle/v2/doc.go delete mode 100644 vendor/github.com/jackc/puddle/v2/internal/genstack/gen_stack.go delete mode 100644 vendor/github.com/jackc/puddle/v2/internal/genstack/stack.go delete mode 100644 vendor/github.com/jackc/puddle/v2/log.go delete mode 100644 vendor/github.com/jackc/puddle/v2/nanotime_time.go delete mode 100644 vendor/github.com/jackc/puddle/v2/nanotime_unsafe.go delete mode 100644 vendor/github.com/jackc/puddle/v2/pool.go delete mode 100644 vendor/github.com/jackc/puddle/v2/resource_list.go delete mode 100644 vendor/github.com/jcchavezs/porto/.golangci.yml delete mode 100644 vendor/github.com/jcchavezs/porto/LICENSE delete mode 100644 vendor/github.com/jcchavezs/porto/Makefile delete mode 100644 vendor/github.com/jcchavezs/porto/README.md delete mode 100644 vendor/github.com/jcchavezs/porto/files.go delete mode 100644 vendor/github.com/jcchavezs/porto/import.go delete mode 100644 vendor/github.com/jcchavezs/porto/regexes.go delete mode 100644 vendor/github.com/joeshaw/multierror/LICENSE delete mode 100644 vendor/github.com/joeshaw/multierror/README.md delete mode 100644 vendor/github.com/joeshaw/multierror/multierror.go delete mode 100644 vendor/github.com/lann/builder/.gitignore delete mode 100644 vendor/github.com/lann/builder/.travis.yml delete mode 100644 vendor/github.com/lann/builder/LICENSE delete mode 100644 vendor/github.com/lann/builder/README.md delete mode 100644 vendor/github.com/lann/builder/builder.go delete mode 100644 vendor/github.com/lann/builder/reflect.go delete mode 100644 vendor/github.com/lann/builder/registry.go delete mode 100644 vendor/github.com/lann/ps/LICENSE delete mode 100644 vendor/github.com/lann/ps/README.md delete mode 100644 vendor/github.com/lann/ps/list.go delete mode 100644 vendor/github.com/lann/ps/map.go delete mode 100644 vendor/github.com/lann/ps/profile.sh delete mode 100644 vendor/github.com/pkg/errors/.gitignore delete mode 100644 vendor/github.com/pkg/errors/.travis.yml delete mode 100644 vendor/github.com/pkg/errors/LICENSE delete mode 100644 vendor/github.com/pkg/errors/Makefile delete mode 100644 vendor/github.com/pkg/errors/README.md delete mode 100644 vendor/github.com/pkg/errors/appveyor.yml delete mode 100644 vendor/github.com/pkg/errors/errors.go delete mode 100644 vendor/github.com/pkg/errors/go113.go delete mode 100644 vendor/github.com/pkg/errors/stack.go delete mode 100644 vendor/github.com/prometheus/procfs/.gitignore delete mode 100644 vendor/github.com/prometheus/procfs/.golangci.yml delete mode 100644 vendor/github.com/prometheus/procfs/CODE_OF_CONDUCT.md delete mode 100644 vendor/github.com/prometheus/procfs/CONTRIBUTING.md delete mode 100644 vendor/github.com/prometheus/procfs/LICENSE delete mode 100644 vendor/github.com/prometheus/procfs/MAINTAINERS.md delete mode 100644 vendor/github.com/prometheus/procfs/Makefile delete mode 100644 vendor/github.com/prometheus/procfs/Makefile.common delete mode 100644 vendor/github.com/prometheus/procfs/NOTICE delete mode 100644 vendor/github.com/prometheus/procfs/README.md delete mode 100644 vendor/github.com/prometheus/procfs/SECURITY.md delete mode 100644 vendor/github.com/prometheus/procfs/arp.go delete mode 100644 vendor/github.com/prometheus/procfs/buddyinfo.go delete mode 100644 vendor/github.com/prometheus/procfs/cmdline.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_armx.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_loong64.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_mipsx.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_others.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_ppcx.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_s390x.go delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_x86.go delete mode 100644 vendor/github.com/prometheus/procfs/crypto.go delete mode 100644 vendor/github.com/prometheus/procfs/doc.go delete mode 100644 vendor/github.com/prometheus/procfs/fs.go delete mode 100644 vendor/github.com/prometheus/procfs/fscache.go delete mode 100644 vendor/github.com/prometheus/procfs/internal/fs/fs.go delete mode 100644 vendor/github.com/prometheus/procfs/internal/util/parse.go delete mode 100644 vendor/github.com/prometheus/procfs/internal/util/readfile.go delete mode 100644 vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go delete mode 100644 vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go delete mode 100644 vendor/github.com/prometheus/procfs/internal/util/valueparser.go delete mode 100644 vendor/github.com/prometheus/procfs/ipvs.go delete mode 100644 vendor/github.com/prometheus/procfs/kernel_random.go delete mode 100644 vendor/github.com/prometheus/procfs/loadavg.go delete mode 100644 vendor/github.com/prometheus/procfs/mdstat.go delete mode 100644 vendor/github.com/prometheus/procfs/meminfo.go delete mode 100644 vendor/github.com/prometheus/procfs/mountinfo.go delete mode 100644 vendor/github.com/prometheus/procfs/mountstats.go delete mode 100644 vendor/github.com/prometheus/procfs/net_conntrackstat.go delete mode 100644 vendor/github.com/prometheus/procfs/net_dev.go delete mode 100644 vendor/github.com/prometheus/procfs/net_ip_socket.go delete mode 100644 vendor/github.com/prometheus/procfs/net_protocols.go delete mode 100644 vendor/github.com/prometheus/procfs/net_sockstat.go delete mode 100644 vendor/github.com/prometheus/procfs/net_softnet.go delete mode 100644 vendor/github.com/prometheus/procfs/net_tcp.go delete mode 100644 vendor/github.com/prometheus/procfs/net_udp.go delete mode 100644 vendor/github.com/prometheus/procfs/net_unix.go delete mode 100644 vendor/github.com/prometheus/procfs/net_xfrm.go delete mode 100644 vendor/github.com/prometheus/procfs/netstat.go delete mode 100644 vendor/github.com/prometheus/procfs/proc.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_cgroup.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_cgroups.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_environ.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_fdinfo.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_interrupts.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_io.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_limits.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_maps.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_netstat.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_ns.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_psi.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_smaps.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_snmp.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_snmp6.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_stat.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_status.go delete mode 100644 vendor/github.com/prometheus/procfs/proc_sys.go delete mode 100644 vendor/github.com/prometheus/procfs/schedstat.go delete mode 100644 vendor/github.com/prometheus/procfs/slab.go delete mode 100644 vendor/github.com/prometheus/procfs/softirqs.go delete mode 100644 vendor/github.com/prometheus/procfs/stat.go delete mode 100644 vendor/github.com/prometheus/procfs/swaps.go delete mode 100644 vendor/github.com/prometheus/procfs/thread.go delete mode 100644 vendor/github.com/prometheus/procfs/ttar delete mode 100644 vendor/github.com/prometheus/procfs/vm.go delete mode 100644 vendor/github.com/prometheus/procfs/zoneinfo.go delete mode 100644 vendor/github.com/redis/go-redis/v9/.gitignore delete mode 100644 vendor/github.com/redis/go-redis/v9/.golangci.yml delete mode 100644 vendor/github.com/redis/go-redis/v9/.prettierrc.yml delete mode 100644 vendor/github.com/redis/go-redis/v9/CHANGELOG.md delete mode 100644 vendor/github.com/redis/go-redis/v9/LICENSE delete mode 100644 vendor/github.com/redis/go-redis/v9/Makefile delete mode 100644 vendor/github.com/redis/go-redis/v9/README.md delete mode 100644 vendor/github.com/redis/go-redis/v9/RELEASING.md delete mode 100644 vendor/github.com/redis/go-redis/v9/cluster.go delete mode 100644 vendor/github.com/redis/go-redis/v9/cluster_commands.go delete mode 100644 vendor/github.com/redis/go-redis/v9/command.go delete mode 100644 vendor/github.com/redis/go-redis/v9/commands.go delete mode 100644 vendor/github.com/redis/go-redis/v9/doc.go delete mode 100644 vendor/github.com/redis/go-redis/v9/error.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/arg.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/hashtag/hashtag.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/hscan/hscan.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/hscan/structmap.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/internal.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/log.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/once.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/pool/conn.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/pool/conn_check.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/pool/conn_check_dummy.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/pool/pool.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/pool/pool_single.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/pool/pool_sticky.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/proto/reader.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/proto/scan.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/proto/writer.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/rand/rand.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/util.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/util/safe.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/util/strconv.go delete mode 100644 vendor/github.com/redis/go-redis/v9/internal/util/unsafe.go delete mode 100644 vendor/github.com/redis/go-redis/v9/iterator.go delete mode 100644 vendor/github.com/redis/go-redis/v9/options.go delete mode 100644 vendor/github.com/redis/go-redis/v9/package.json delete mode 100644 vendor/github.com/redis/go-redis/v9/pipeline.go delete mode 100644 vendor/github.com/redis/go-redis/v9/pubsub.go delete mode 100644 vendor/github.com/redis/go-redis/v9/redis.go delete mode 100644 vendor/github.com/redis/go-redis/v9/result.go delete mode 100644 vendor/github.com/redis/go-redis/v9/ring.go delete mode 100644 vendor/github.com/redis/go-redis/v9/script.go delete mode 100644 vendor/github.com/redis/go-redis/v9/sentinel.go delete mode 100644 vendor/github.com/redis/go-redis/v9/tx.go delete mode 100644 vendor/github.com/redis/go-redis/v9/universal.go delete mode 100644 vendor/github.com/redis/go-redis/v9/version.go delete mode 100644 vendor/github.com/santhosh-tekuri/jsonschema/.travis.yml delete mode 100644 vendor/github.com/santhosh-tekuri/jsonschema/LICENSE delete mode 100644 vendor/github.com/santhosh-tekuri/jsonschema/README.md delete mode 100644 vendor/github.com/santhosh-tekuri/jsonschema/compiler.go delete mode 100644 vendor/github.com/santhosh-tekuri/jsonschema/decoders/decoders.go delete mode 100644 vendor/github.com/santhosh-tekuri/jsonschema/doc.go delete mode 100644 vendor/github.com/santhosh-tekuri/jsonschema/draft4.go delete mode 100644 vendor/github.com/santhosh-tekuri/jsonschema/draft6.go delete mode 100644 vendor/github.com/santhosh-tekuri/jsonschema/draft7.go delete mode 100644 vendor/github.com/santhosh-tekuri/jsonschema/errors.go delete mode 100644 vendor/github.com/santhosh-tekuri/jsonschema/formats/formats.go delete mode 100644 vendor/github.com/santhosh-tekuri/jsonschema/go.test.sh delete mode 100644 vendor/github.com/santhosh-tekuri/jsonschema/loader/loader.go delete mode 100644 vendor/github.com/santhosh-tekuri/jsonschema/mediatypes/mediatypes.go delete mode 100644 vendor/github.com/santhosh-tekuri/jsonschema/resource.go delete mode 100644 vendor/github.com/santhosh-tekuri/jsonschema/schema.go delete mode 100644 vendor/go.elastic.co/apm/.dockerignore delete mode 100644 vendor/go.elastic.co/apm/.gitignore delete mode 100644 vendor/go.elastic.co/apm/.jenkins-edge.yml delete mode 100644 vendor/go.elastic.co/apm/.jenkins.yml delete mode 100644 vendor/go.elastic.co/apm/CHANGELOG.asciidoc delete mode 100644 vendor/go.elastic.co/apm/CHANGELOG.md delete mode 100644 vendor/go.elastic.co/apm/CODE_OF_CONDUCT.md delete mode 100644 vendor/go.elastic.co/apm/CONTRIBUTING.md delete mode 100644 vendor/go.elastic.co/apm/Jenkinsfile delete mode 100644 vendor/go.elastic.co/apm/LICENSE delete mode 100644 vendor/go.elastic.co/apm/Makefile delete mode 100644 vendor/go.elastic.co/apm/NOTICE delete mode 100644 vendor/go.elastic.co/apm/README.md delete mode 100644 vendor/go.elastic.co/apm/SECURITY.md delete mode 100644 vendor/go.elastic.co/apm/apmconfig/doc.go delete mode 100644 vendor/go.elastic.co/apm/apmconfig/watcher.go delete mode 100644 vendor/go.elastic.co/apm/breakdown.go delete mode 100644 vendor/go.elastic.co/apm/builtin_metrics.go delete mode 100644 vendor/go.elastic.co/apm/capturebody.go delete mode 100644 vendor/go.elastic.co/apm/config.go delete mode 100644 vendor/go.elastic.co/apm/context.go delete mode 100644 vendor/go.elastic.co/apm/doc.go delete mode 100644 vendor/go.elastic.co/apm/error.go delete mode 100644 vendor/go.elastic.co/apm/error_unix.go delete mode 100644 vendor/go.elastic.co/apm/error_windows.go delete mode 100644 vendor/go.elastic.co/apm/fmt.go delete mode 100644 vendor/go.elastic.co/apm/fnv.go delete mode 100644 vendor/go.elastic.co/apm/gocontext.go delete mode 100644 vendor/go.elastic.co/apm/gofuzz.go delete mode 100644 vendor/go.elastic.co/apm/internal/apmcloudutil/aws.go delete mode 100644 vendor/go.elastic.co/apm/internal/apmcloudutil/azure.go delete mode 100644 vendor/go.elastic.co/apm/internal/apmcloudutil/gcp.go delete mode 100644 vendor/go.elastic.co/apm/internal/apmcloudutil/provider.go delete mode 100644 vendor/go.elastic.co/apm/internal/apmcontext/context.go delete mode 100644 vendor/go.elastic.co/apm/internal/apmhostutil/container.go delete mode 100644 vendor/go.elastic.co/apm/internal/apmhostutil/container_linux.go delete mode 100644 vendor/go.elastic.co/apm/internal/apmhostutil/container_nonlinux.go delete mode 100644 vendor/go.elastic.co/apm/internal/apmhttputil/forwarded.go delete mode 100644 vendor/go.elastic.co/apm/internal/apmhttputil/remoteaddr.go delete mode 100644 vendor/go.elastic.co/apm/internal/apmhttputil/url.go delete mode 100644 vendor/go.elastic.co/apm/internal/apmlog/logger.go delete mode 100644 vendor/go.elastic.co/apm/internal/apmmath/round_go10.go delete mode 100644 vendor/go.elastic.co/apm/internal/apmmath/round_go9.go delete mode 100644 vendor/go.elastic.co/apm/internal/apmschema/schema.go delete mode 100644 vendor/go.elastic.co/apm/internal/apmschema/update.sh delete mode 100644 vendor/go.elastic.co/apm/internal/apmstrings/concat10.go delete mode 100644 vendor/go.elastic.co/apm/internal/apmstrings/concat9.go delete mode 100644 vendor/go.elastic.co/apm/internal/apmstrings/truncate.go delete mode 100644 vendor/go.elastic.co/apm/internal/apmversion/version.go delete mode 100644 vendor/go.elastic.co/apm/internal/configutil/duration.go delete mode 100644 vendor/go.elastic.co/apm/internal/configutil/env.go delete mode 100644 vendor/go.elastic.co/apm/internal/configutil/list.go delete mode 100644 vendor/go.elastic.co/apm/internal/configutil/size.go delete mode 100644 vendor/go.elastic.co/apm/internal/configutil/wildcards.go delete mode 100644 vendor/go.elastic.co/apm/internal/iochan/doc.go delete mode 100644 vendor/go.elastic.co/apm/internal/iochan/reader.go delete mode 100644 vendor/go.elastic.co/apm/internal/pkgerrorsutil/pkgerrors.go delete mode 100644 vendor/go.elastic.co/apm/internal/ringbuffer/buffer.go delete mode 100644 vendor/go.elastic.co/apm/internal/ringbuffer/doc.go delete mode 100644 vendor/go.elastic.co/apm/internal/wildcard/doc.go delete mode 100644 vendor/go.elastic.co/apm/internal/wildcard/matcher.go delete mode 100644 vendor/go.elastic.co/apm/internal/wildcard/matchers.go delete mode 100644 vendor/go.elastic.co/apm/logger.go delete mode 100644 vendor/go.elastic.co/apm/metrics.go delete mode 100644 vendor/go.elastic.co/apm/model/doc.go delete mode 100644 vendor/go.elastic.co/apm/model/generate.sh delete mode 100644 vendor/go.elastic.co/apm/model/gofuzz.go delete mode 100644 vendor/go.elastic.co/apm/model/maps.go delete mode 100644 vendor/go.elastic.co/apm/model/marshal.go delete mode 100644 vendor/go.elastic.co/apm/model/marshal_fastjson.go delete mode 100644 vendor/go.elastic.co/apm/model/model.go delete mode 100644 vendor/go.elastic.co/apm/modelwriter.go delete mode 100644 vendor/go.elastic.co/apm/module/apmhttp/LICENSE delete mode 100644 vendor/go.elastic.co/apm/module/apmhttp/client.go delete mode 100644 vendor/go.elastic.co/apm/module/apmhttp/clienttrace.go delete mode 100644 vendor/go.elastic.co/apm/module/apmhttp/context.go delete mode 100644 vendor/go.elastic.co/apm/module/apmhttp/doc.go delete mode 100644 vendor/go.elastic.co/apm/module/apmhttp/handler.go delete mode 100644 vendor/go.elastic.co/apm/module/apmhttp/ignorer.go delete mode 100644 vendor/go.elastic.co/apm/module/apmhttp/recovery.go delete mode 100644 vendor/go.elastic.co/apm/module/apmhttp/requestname.go delete mode 100644 vendor/go.elastic.co/apm/module/apmhttp/requestname_go19.go delete mode 100644 vendor/go.elastic.co/apm/module/apmhttp/traceheaders.go delete mode 100644 vendor/go.elastic.co/apm/profiling.go delete mode 100644 vendor/go.elastic.co/apm/sampler.go delete mode 100644 vendor/go.elastic.co/apm/sanitizer.go delete mode 100644 vendor/go.elastic.co/apm/span.go delete mode 100644 vendor/go.elastic.co/apm/span_compressed.go delete mode 100644 vendor/go.elastic.co/apm/spancontext.go delete mode 100644 vendor/go.elastic.co/apm/stacktrace.go delete mode 100644 vendor/go.elastic.co/apm/stacktrace/context.go delete mode 100644 vendor/go.elastic.co/apm/stacktrace/doc.go delete mode 100644 vendor/go.elastic.co/apm/stacktrace/frame.go delete mode 100644 vendor/go.elastic.co/apm/stacktrace/generate_library.bash delete mode 100644 vendor/go.elastic.co/apm/stacktrace/library.go delete mode 100644 vendor/go.elastic.co/apm/stacktrace/stacktrace.go delete mode 100644 vendor/go.elastic.co/apm/tools.go delete mode 100644 vendor/go.elastic.co/apm/tracecontext.go delete mode 100644 vendor/go.elastic.co/apm/tracer.go delete mode 100644 vendor/go.elastic.co/apm/tracer_stats.go delete mode 100644 vendor/go.elastic.co/apm/transaction.go delete mode 100644 vendor/go.elastic.co/apm/transport/api.go delete mode 100644 vendor/go.elastic.co/apm/transport/default.go delete mode 100644 vendor/go.elastic.co/apm/transport/discard.go delete mode 100644 vendor/go.elastic.co/apm/transport/doc.go delete mode 100644 vendor/go.elastic.co/apm/transport/http.go delete mode 100644 vendor/go.elastic.co/apm/utils.go delete mode 100644 vendor/go.elastic.co/apm/utils_linux.go delete mode 100644 vendor/go.elastic.co/apm/utils_other.go delete mode 100644 vendor/go.elastic.co/apm/version.go delete mode 100644 vendor/go.elastic.co/fastjson/.travis.yml delete mode 100644 vendor/go.elastic.co/fastjson/LICENSE delete mode 100644 vendor/go.elastic.co/fastjson/README.md delete mode 100644 vendor/go.elastic.co/fastjson/doc.go delete mode 100644 vendor/go.elastic.co/fastjson/marshaler.go delete mode 100644 vendor/go.elastic.co/fastjson/writer.go delete mode 100644 vendor/go.uber.org/atomic/.codecov.yml delete mode 100644 vendor/go.uber.org/atomic/.gitignore delete mode 100644 vendor/go.uber.org/atomic/CHANGELOG.md delete mode 100644 vendor/go.uber.org/atomic/LICENSE.txt delete mode 100644 vendor/go.uber.org/atomic/Makefile delete mode 100644 vendor/go.uber.org/atomic/README.md delete mode 100644 vendor/go.uber.org/atomic/bool.go delete mode 100644 vendor/go.uber.org/atomic/bool_ext.go delete mode 100644 vendor/go.uber.org/atomic/doc.go delete mode 100644 vendor/go.uber.org/atomic/duration.go delete mode 100644 vendor/go.uber.org/atomic/duration_ext.go delete mode 100644 vendor/go.uber.org/atomic/error.go delete mode 100644 vendor/go.uber.org/atomic/error_ext.go delete mode 100644 vendor/go.uber.org/atomic/float32.go delete mode 100644 vendor/go.uber.org/atomic/float32_ext.go delete mode 100644 vendor/go.uber.org/atomic/float64.go delete mode 100644 vendor/go.uber.org/atomic/float64_ext.go delete mode 100644 vendor/go.uber.org/atomic/gen.go delete mode 100644 vendor/go.uber.org/atomic/int32.go delete mode 100644 vendor/go.uber.org/atomic/int64.go delete mode 100644 vendor/go.uber.org/atomic/nocmp.go delete mode 100644 vendor/go.uber.org/atomic/pointer_go118.go delete mode 100644 vendor/go.uber.org/atomic/pointer_go119.go delete mode 100644 vendor/go.uber.org/atomic/string.go delete mode 100644 vendor/go.uber.org/atomic/string_ext.go delete mode 100644 vendor/go.uber.org/atomic/time.go delete mode 100644 vendor/go.uber.org/atomic/time_ext.go delete mode 100644 vendor/go.uber.org/atomic/uint32.go delete mode 100644 vendor/go.uber.org/atomic/uint64.go delete mode 100644 vendor/go.uber.org/atomic/uintptr.go delete mode 100644 vendor/go.uber.org/atomic/unsafe_pointer.go delete mode 100644 vendor/go.uber.org/atomic/value.go delete mode 100644 vendor/golang.org/x/crypto/LICENSE delete mode 100644 vendor/golang.org/x/crypto/PATENTS delete mode 100644 vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go delete mode 100644 vendor/golang.org/x/lint/.travis.yml delete mode 100644 vendor/golang.org/x/lint/CONTRIBUTING.md delete mode 100644 vendor/golang.org/x/lint/LICENSE delete mode 100644 vendor/golang.org/x/lint/README.md delete mode 100644 vendor/golang.org/x/lint/golint/golint.go delete mode 100644 vendor/golang.org/x/lint/golint/import.go delete mode 100644 vendor/golang.org/x/lint/golint/importcomment.go delete mode 100644 vendor/golang.org/x/lint/lint.go delete mode 100644 vendor/golang.org/x/mod/LICENSE delete mode 100644 vendor/golang.org/x/mod/PATENTS delete mode 100644 vendor/golang.org/x/mod/internal/lazyregexp/lazyre.go delete mode 100644 vendor/golang.org/x/mod/modfile/print.go delete mode 100644 vendor/golang.org/x/mod/modfile/read.go delete mode 100644 vendor/golang.org/x/mod/modfile/rule.go delete mode 100644 vendor/golang.org/x/mod/modfile/work.go delete mode 100644 vendor/golang.org/x/mod/module/module.go delete mode 100644 vendor/golang.org/x/mod/module/pseudo.go delete mode 100644 vendor/golang.org/x/mod/semver/semver.go delete mode 100644 vendor/golang.org/x/sync/LICENSE delete mode 100644 vendor/golang.org/x/sync/PATENTS delete mode 100644 vendor/golang.org/x/sync/semaphore/semaphore.go delete mode 100644 vendor/golang.org/x/sys/LICENSE delete mode 100644 vendor/golang.org/x/sys/PATENTS delete mode 100644 vendor/golang.org/x/sys/execabs/execabs.go delete mode 100644 vendor/golang.org/x/sys/execabs/execabs_go118.go delete mode 100644 vendor/golang.org/x/sys/execabs/execabs_go119.go delete mode 100644 vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go delete mode 100644 vendor/golang.org/x/sys/unix/.gitignore delete mode 100644 vendor/golang.org/x/sys/unix/README.md delete mode 100644 vendor/golang.org/x/sys/unix/affinity_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/aliases.go delete mode 100644 vendor/golang.org/x/sys/unix/asm_aix_ppc64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_bsd_386.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_bsd_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_bsd_arm.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_bsd_arm64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_386.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_arm.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_arm64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_loong64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_mips64x.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_mipsx.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_riscv64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_linux_s390x.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_solaris_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_zos_s390x.s delete mode 100644 vendor/golang.org/x/sys/unix/bluetooth_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/cap_freebsd.go delete mode 100644 vendor/golang.org/x/sys/unix/constants.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_aix_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_aix_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_darwin.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_dragonfly.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_freebsd.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_netbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_openbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/dev_zos.go delete mode 100644 vendor/golang.org/x/sys/unix/dirent.go delete mode 100644 vendor/golang.org/x/sys/unix/endian_big.go delete mode 100644 vendor/golang.org/x/sys/unix/endian_little.go delete mode 100644 vendor/golang.org/x/sys/unix/env_unix.go delete mode 100644 vendor/golang.org/x/sys/unix/epoll_zos.go delete mode 100644 vendor/golang.org/x/sys/unix/fcntl.go delete mode 100644 vendor/golang.org/x/sys/unix/fcntl_darwin.go delete mode 100644 vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go delete mode 100644 vendor/golang.org/x/sys/unix/fdset.go delete mode 100644 vendor/golang.org/x/sys/unix/fstatfs_zos.go delete mode 100644 vendor/golang.org/x/sys/unix/gccgo.go delete mode 100644 vendor/golang.org/x/sys/unix/gccgo_c.c delete mode 100644 vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ifreq_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/ioctl.go delete mode 100644 vendor/golang.org/x/sys/unix/ioctl_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/ioctl_zos.go delete mode 100644 vendor/golang.org/x/sys/unix/mkall.sh delete mode 100644 vendor/golang.org/x/sys/unix/mkerrors.sh delete mode 100644 vendor/golang.org/x/sys/unix/pagesize_unix.go delete mode 100644 vendor/golang.org/x/sys/unix/pledge_openbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/ptrace_darwin.go delete mode 100644 vendor/golang.org/x/sys/unix/ptrace_ios.go delete mode 100644 vendor/golang.org/x/sys/unix/race.go delete mode 100644 vendor/golang.org/x/sys/unix/race0.go delete mode 100644 vendor/golang.org/x/sys/unix/readdirent_getdents.go delete mode 100644 vendor/golang.org/x/sys/unix/readdirent_getdirentries.go delete mode 100644 vendor/golang.org/x/sys/unix/sockcmsg_dragonfly.go delete mode 100644 vendor/golang.org/x/sys/unix/sockcmsg_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/sockcmsg_unix.go delete mode 100644 vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_aix.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_aix_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_bsd.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_dragonfly.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_hurd.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_hurd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_illumos.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_alarm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gc.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_loong64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_solaris.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_unix.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_unix_gc.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_zos_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/sysvshm_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/sysvshm_unix.go delete mode 100644 vendor/golang.org/x/sys/unix/sysvshm_unix_other.go delete mode 100644 vendor/golang.org/x/sys/unix/timestruct.go delete mode 100644 vendor/golang.org/x/sys/unix/unveil_openbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/xattr_bsd.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_mips.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zptrace_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zptrace_x86_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_386.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_mips.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go delete mode 100644 vendor/golang.org/x/sys/windows/aliases.go delete mode 100644 vendor/golang.org/x/sys/windows/dll_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/empty.s delete mode 100644 vendor/golang.org/x/sys/windows/env_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/eventlog.go delete mode 100644 vendor/golang.org/x/sys/windows/exec_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/memory_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/mkerrors.bash delete mode 100644 vendor/golang.org/x/sys/windows/mkknownfolderids.bash delete mode 100644 vendor/golang.org/x/sys/windows/mksyscall.go delete mode 100644 vendor/golang.org/x/sys/windows/race.go delete mode 100644 vendor/golang.org/x/sys/windows/race0.go delete mode 100644 vendor/golang.org/x/sys/windows/registry/key.go delete mode 100644 vendor/golang.org/x/sys/windows/registry/mksyscall.go delete mode 100644 vendor/golang.org/x/sys/windows/registry/syscall.go delete mode 100644 vendor/golang.org/x/sys/windows/registry/value.go delete mode 100644 vendor/golang.org/x/sys/windows/registry/zsyscall_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/security_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/service.go delete mode 100644 vendor/golang.org/x/sys/windows/setupapi_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/str.go delete mode 100644 vendor/golang.org/x/sys/windows/syscall.go delete mode 100644 vendor/golang.org/x/sys/windows/syscall_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/types_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/types_windows_386.go delete mode 100644 vendor/golang.org/x/sys/windows/types_windows_amd64.go delete mode 100644 vendor/golang.org/x/sys/windows/types_windows_arm.go delete mode 100644 vendor/golang.org/x/sys/windows/types_windows_arm64.go delete mode 100644 vendor/golang.org/x/sys/windows/zerrors_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/zknownfolderids_windows.go delete mode 100644 vendor/golang.org/x/sys/windows/zsyscall_windows.go delete mode 100644 vendor/golang.org/x/text/LICENSE delete mode 100644 vendor/golang.org/x/text/PATENTS delete mode 100644 vendor/golang.org/x/text/cases/cases.go delete mode 100644 vendor/golang.org/x/text/cases/context.go delete mode 100644 vendor/golang.org/x/text/cases/fold.go delete mode 100644 vendor/golang.org/x/text/cases/icu.go delete mode 100644 vendor/golang.org/x/text/cases/info.go delete mode 100644 vendor/golang.org/x/text/cases/map.go delete mode 100644 vendor/golang.org/x/text/cases/tables10.0.0.go delete mode 100644 vendor/golang.org/x/text/cases/tables11.0.0.go delete mode 100644 vendor/golang.org/x/text/cases/tables12.0.0.go delete mode 100644 vendor/golang.org/x/text/cases/tables13.0.0.go delete mode 100644 vendor/golang.org/x/text/cases/tables9.0.0.go delete mode 100644 vendor/golang.org/x/text/cases/trieval.go delete mode 100644 vendor/golang.org/x/text/internal/internal.go delete mode 100644 vendor/golang.org/x/text/internal/language/common.go delete mode 100644 vendor/golang.org/x/text/internal/language/compact.go delete mode 100644 vendor/golang.org/x/text/internal/language/compact/compact.go delete mode 100644 vendor/golang.org/x/text/internal/language/compact/language.go delete mode 100644 vendor/golang.org/x/text/internal/language/compact/parents.go delete mode 100644 vendor/golang.org/x/text/internal/language/compact/tables.go delete mode 100644 vendor/golang.org/x/text/internal/language/compact/tags.go delete mode 100644 vendor/golang.org/x/text/internal/language/compose.go delete mode 100644 vendor/golang.org/x/text/internal/language/coverage.go delete mode 100644 vendor/golang.org/x/text/internal/language/language.go delete mode 100644 vendor/golang.org/x/text/internal/language/lookup.go delete mode 100644 vendor/golang.org/x/text/internal/language/match.go delete mode 100644 vendor/golang.org/x/text/internal/language/parse.go delete mode 100644 vendor/golang.org/x/text/internal/language/tables.go delete mode 100644 vendor/golang.org/x/text/internal/language/tags.go delete mode 100644 vendor/golang.org/x/text/internal/match.go delete mode 100644 vendor/golang.org/x/text/internal/tag/tag.go delete mode 100644 vendor/golang.org/x/text/language/coverage.go delete mode 100644 vendor/golang.org/x/text/language/doc.go delete mode 100644 vendor/golang.org/x/text/language/language.go delete mode 100644 vendor/golang.org/x/text/language/match.go delete mode 100644 vendor/golang.org/x/text/language/parse.go delete mode 100644 vendor/golang.org/x/text/language/tables.go delete mode 100644 vendor/golang.org/x/text/language/tags.go delete mode 100644 vendor/golang.org/x/text/runes/cond.go delete mode 100644 vendor/golang.org/x/text/runes/runes.go delete mode 100644 vendor/golang.org/x/text/secure/bidirule/bidirule.go delete mode 100644 vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go delete mode 100644 vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go delete mode 100644 vendor/golang.org/x/text/secure/precis/class.go delete mode 100644 vendor/golang.org/x/text/secure/precis/context.go delete mode 100644 vendor/golang.org/x/text/secure/precis/doc.go delete mode 100644 vendor/golang.org/x/text/secure/precis/nickname.go delete mode 100644 vendor/golang.org/x/text/secure/precis/options.go delete mode 100644 vendor/golang.org/x/text/secure/precis/profile.go delete mode 100644 vendor/golang.org/x/text/secure/precis/profiles.go delete mode 100644 vendor/golang.org/x/text/secure/precis/tables10.0.0.go delete mode 100644 vendor/golang.org/x/text/secure/precis/tables11.0.0.go delete mode 100644 vendor/golang.org/x/text/secure/precis/tables12.0.0.go delete mode 100644 vendor/golang.org/x/text/secure/precis/tables13.0.0.go delete mode 100644 vendor/golang.org/x/text/secure/precis/tables9.0.0.go delete mode 100644 vendor/golang.org/x/text/secure/precis/transformer.go delete mode 100644 vendor/golang.org/x/text/secure/precis/trieval.go delete mode 100644 vendor/golang.org/x/text/transform/transform.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/bidi.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/bracket.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/core.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/prop.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/bidi/trieval.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/composition.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/forminfo.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/input.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/iter.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/normalize.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/readwriter.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/tables10.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/tables11.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/tables12.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/tables13.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/tables9.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/transform.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/trie.go delete mode 100644 vendor/golang.org/x/text/width/kind_string.go delete mode 100644 vendor/golang.org/x/text/width/tables10.0.0.go delete mode 100644 vendor/golang.org/x/text/width/tables11.0.0.go delete mode 100644 vendor/golang.org/x/text/width/tables12.0.0.go delete mode 100644 vendor/golang.org/x/text/width/tables13.0.0.go delete mode 100644 vendor/golang.org/x/text/width/tables9.0.0.go delete mode 100644 vendor/golang.org/x/text/width/transform.go delete mode 100644 vendor/golang.org/x/text/width/trieval.go delete mode 100644 vendor/golang.org/x/text/width/width.go delete mode 100644 vendor/golang.org/x/tools/LICENSE delete mode 100644 vendor/golang.org/x/tools/PATENTS delete mode 100644 vendor/golang.org/x/tools/cmd/goimports/doc.go delete mode 100644 vendor/golang.org/x/tools/cmd/goimports/goimports.go delete mode 100644 vendor/golang.org/x/tools/cmd/goimports/goimports_gc.go delete mode 100644 vendor/golang.org/x/tools/cmd/goimports/goimports_not_gc.go delete mode 100644 vendor/golang.org/x/tools/go/ast/astutil/enclosing.go delete mode 100644 vendor/golang.org/x/tools/go/ast/astutil/imports.go delete mode 100644 vendor/golang.org/x/tools/go/ast/astutil/rewrite.go delete mode 100644 vendor/golang.org/x/tools/go/ast/astutil/util.go delete mode 100644 vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go delete mode 100644 vendor/golang.org/x/tools/go/gcexportdata/importer.go delete mode 100644 vendor/golang.org/x/tools/internal/event/core/event.go delete mode 100644 vendor/golang.org/x/tools/internal/event/core/export.go delete mode 100644 vendor/golang.org/x/tools/internal/event/core/fast.go delete mode 100644 vendor/golang.org/x/tools/internal/event/doc.go delete mode 100644 vendor/golang.org/x/tools/internal/event/event.go delete mode 100644 vendor/golang.org/x/tools/internal/event/keys/keys.go delete mode 100644 vendor/golang.org/x/tools/internal/event/keys/standard.go delete mode 100644 vendor/golang.org/x/tools/internal/event/label/label.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_darwin.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_fileno.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_ino.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_portable.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go delete mode 100644 vendor/golang.org/x/tools/internal/gcimporter/bexport.go delete mode 100644 vendor/golang.org/x/tools/internal/gcimporter/bimport.go delete mode 100644 vendor/golang.org/x/tools/internal/gcimporter/exportdata.go delete mode 100644 vendor/golang.org/x/tools/internal/gcimporter/gcimporter.go delete mode 100644 vendor/golang.org/x/tools/internal/gcimporter/iexport.go delete mode 100644 vendor/golang.org/x/tools/internal/gcimporter/iimport.go delete mode 100644 vendor/golang.org/x/tools/internal/gcimporter/newInterface10.go delete mode 100644 vendor/golang.org/x/tools/internal/gcimporter/newInterface11.go delete mode 100644 vendor/golang.org/x/tools/internal/gcimporter/support_go117.go delete mode 100644 vendor/golang.org/x/tools/internal/gcimporter/support_go118.go delete mode 100644 vendor/golang.org/x/tools/internal/gcimporter/unified_no.go delete mode 100644 vendor/golang.org/x/tools/internal/gcimporter/unified_yes.go delete mode 100644 vendor/golang.org/x/tools/internal/gcimporter/ureader_no.go delete mode 100644 vendor/golang.org/x/tools/internal/gcimporter/ureader_yes.go delete mode 100644 vendor/golang.org/x/tools/internal/gocommand/invoke.go delete mode 100644 vendor/golang.org/x/tools/internal/gocommand/vendor.go delete mode 100644 vendor/golang.org/x/tools/internal/gocommand/version.go delete mode 100644 vendor/golang.org/x/tools/internal/gopathwalk/walk.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/fix.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/imports.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/mod.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/mod_cache.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/sortimports.go delete mode 100644 vendor/golang.org/x/tools/internal/imports/zstdlib.go delete mode 100644 vendor/golang.org/x/tools/internal/pkgbits/codes.go delete mode 100644 vendor/golang.org/x/tools/internal/pkgbits/decoder.go delete mode 100644 vendor/golang.org/x/tools/internal/pkgbits/doc.go delete mode 100644 vendor/golang.org/x/tools/internal/pkgbits/encoder.go delete mode 100644 vendor/golang.org/x/tools/internal/pkgbits/flags.go delete mode 100644 vendor/golang.org/x/tools/internal/pkgbits/frames_go1.go delete mode 100644 vendor/golang.org/x/tools/internal/pkgbits/frames_go17.go delete mode 100644 vendor/golang.org/x/tools/internal/pkgbits/reloc.go delete mode 100644 vendor/golang.org/x/tools/internal/pkgbits/support.go delete mode 100644 vendor/golang.org/x/tools/internal/pkgbits/sync.go delete mode 100644 vendor/golang.org/x/tools/internal/pkgbits/syncmarker_string.go delete mode 100644 vendor/golang.org/x/tools/internal/typeparams/common.go delete mode 100644 vendor/golang.org/x/tools/internal/typeparams/coretype.go delete mode 100644 vendor/golang.org/x/tools/internal/typeparams/enabled_go117.go delete mode 100644 vendor/golang.org/x/tools/internal/typeparams/enabled_go118.go delete mode 100644 vendor/golang.org/x/tools/internal/typeparams/normalize.go delete mode 100644 vendor/golang.org/x/tools/internal/typeparams/termlist.go delete mode 100644 vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go delete mode 100644 vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go delete mode 100644 vendor/golang.org/x/tools/internal/typeparams/typeterm.go delete mode 100644 vendor/howett.net/plist/.gitignore delete mode 100644 vendor/howett.net/plist/.gitlab-ci.yml delete mode 100644 vendor/howett.net/plist/LICENSE delete mode 100644 vendor/howett.net/plist/README.md delete mode 100644 vendor/howett.net/plist/bplist.go delete mode 100644 vendor/howett.net/plist/bplist_generator.go delete mode 100644 vendor/howett.net/plist/bplist_parser.go delete mode 100644 vendor/howett.net/plist/decode.go delete mode 100644 vendor/howett.net/plist/doc.go delete mode 100644 vendor/howett.net/plist/encode.go delete mode 100644 vendor/howett.net/plist/fuzz.go delete mode 100644 vendor/howett.net/plist/marshal.go delete mode 100644 vendor/howett.net/plist/must.go delete mode 100644 vendor/howett.net/plist/plist.go delete mode 100644 vendor/howett.net/plist/plist_types.go delete mode 100644 vendor/howett.net/plist/text_generator.go delete mode 100644 vendor/howett.net/plist/text_parser.go delete mode 100644 vendor/howett.net/plist/text_tables.go delete mode 100644 vendor/howett.net/plist/typeinfo.go delete mode 100644 vendor/howett.net/plist/unmarshal.go delete mode 100644 vendor/howett.net/plist/util.go delete mode 100644 vendor/howett.net/plist/xml_generator.go delete mode 100644 vendor/howett.net/plist/xml_parser.go delete mode 100644 vendor/howett.net/plist/zerocopy.go delete mode 100644 vendor/howett.net/plist/zerocopy_appengine.go delete mode 100644 vendor/modules.txt diff --git a/cmd/booking/list b/cmd/booking/list new file mode 100644 index 0000000..b1c732c --- /dev/null +++ b/cmd/booking/list @@ -0,0 +1,186 @@ +range: 76 - 104 +076 +077 +078 +079 +080 +081 +082 +083 +084 +085 +086 +087 +088 +089 +090 +091 +092 +093 +094 +095 +096 +097 +098 +099 +100 +101 +102 +103 +104 +range: 81 - 84 +081 +082 +083 +084 +range: 85 - 92 +085 +086 +087 +088 +089 +090 +091 +092 +range: 88 - 96 +088 +089 +090 +091 +092 +093 +094 +095 +096 +range: 92 - 100 +092 +093 +094 +095 +096 +097 +098 +099 +100 +range: 93 - 104 +093 +094 +095 +096 +097 +098 +099 +100 +101 +102 +103 +104 +104 +range: 153 - 156 +153 +154 +155 +156 +range: 153 - 189 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +range: 156 - 164 +156 +157 +158 +159 +160 +161 +162 +163 +164 +range: 161 - 168 +161 +162 +163 +164 +165 +166 +167 +168 +range: 161 - 168 +161 +162 +163 +164 +165 +166 +167 +168 +range: 177 - 184 +177 +178 +179 +180 +181 +182 +183 +184 +177 +range: 177 - 192 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +range: 185 - 192 +185 +186 +187 +188 +189 +190 +191 +192 +197 diff --git a/cmd/booking/main.go b/cmd/booking/main.go new file mode 100644 index 0000000..c5b2354 --- /dev/null +++ b/cmd/booking/main.go @@ -0,0 +1,59 @@ +package main + +import ( + "fmt" + "strconv" + "strings" +) + +func main() { + adtechTeams := map[string]struct{}{ + "081-084": {}, + "085-092": {}, + "092-100": {}, + "153-156": {}, + "161-168": {}, + "177-184": {}, + } + + firstFloorBTeamBookings := []string{ + "076-104", + "081-084", + "085-092", + "088-096", + "092-100", + "093-104", + "104", + "153-156", + "153-189", + "156-164", + "161-168", + "161-168", + "177-184", + "177-184 ", + "177-192", + "185-192", + "197-184", + } + + for _, srange := range firstFloorBTeamBookings { + parts := strings.Split(srange, "-") + start, _ := strconv.Atoi(parts[0]) + end := -1 + if len(parts) == 2 { + end, _ = strconv.Atoi(parts[1]) + } + if end > start { + fmt.Printf("range: %d - %d\n", start, end) + for start <= end { + fmt.Printf("%03d\n", start) + start++ + } + } else { + fmt.Println(start) + } + } + + _ = firstFloorBTeamBookings + _ = adtechTeams +} diff --git a/cmd/server/grpc/grpc.go b/cmd/server/grpc/grpc.go new file mode 100644 index 0000000..5de7acd --- /dev/null +++ b/cmd/server/grpc/grpc.go @@ -0,0 +1,13 @@ +package grpc + +import "github.com/bnkamalesh/goapp/internal/api" + +type GRPC struct { + apis api.Server +} + +func New(apis api.Server) *GRPC { + return &GRPC{ + apis: apis, + } +} diff --git a/internal/server/http/handlers.go b/cmd/server/http/handlers.go similarity index 93% rename from internal/server/http/handlers.go rename to cmd/server/http/handlers.go index 7d1af59..40a1a5a 100644 --- a/internal/server/http/handlers.go +++ b/cmd/server/http/handlers.go @@ -16,7 +16,7 @@ import ( // Handlers struct has all the dependencies required for HTTP handlers type Handlers struct { - api *api.API + apis api.Server home *template.Template } @@ -56,7 +56,7 @@ func (h *Handlers) routes() []*webgo.Route { // Health is the HTTP handler to return the status of the app including the version, and other details // This handler uses webgo to respond to the http request func (h *Handlers) Health(w http.ResponseWriter, r *http.Request) error { - out, err := h.api.Health() + out, err := h.apis.ServerHealth() if err != nil { return err } @@ -80,7 +80,7 @@ func (h *Handlers) HelloWorld(w http.ResponseWriter, r *http.Request) error { struct { Message string }{ - Message: "welcome to the home page!", + Message: "Welcome to the Home Page!", }, ) if err != nil { @@ -106,7 +106,7 @@ func errWrapper(h func(w http.ResponseWriter, r *http.Request) error) http.Handl status, msg, _ := errors.HTTPStatusCodeMessage(err) webgo.SendError(w, msg, status) - _ = logger.Error(errors.Stacktrace(err)) + _ = logger.Error(r.Context(), errors.Stacktrace(err)) } } @@ -118,7 +118,7 @@ func panicRecoverer(w http.ResponseWriter, r *http.Request, next http.HandlerFun } webgo.R500(w, errors.DefaultMessage) - _ = logger.Error(fmt.Sprintf("%+v", p)) + _ = logger.Error(r.Context(), fmt.Sprintf("%+v", p)) fmt.Println(string(debug.Stack())) }() diff --git a/internal/server/http/handlers_users.go b/cmd/server/http/handlers_users.go similarity index 90% rename from internal/server/http/handlers_users.go rename to cmd/server/http/handlers_users.go index 8a2404a..bd7d15f 100644 --- a/internal/server/http/handlers_users.go +++ b/cmd/server/http/handlers_users.go @@ -19,7 +19,7 @@ func (h *Handlers) CreateUser(w http.ResponseWriter, r *http.Request) error { return errors.InputBodyErr(err, "invalid JSON provided") } - createdUser, err := h.api.CreateUser(r.Context(), u) + createdUser, err := h.apis.CreateUser(r.Context(), u) if err != nil { return err } @@ -34,6 +34,7 @@ func (h *Handlers) CreateUser(w http.ResponseWriter, r *http.Request) error { if err != nil { return errors.Wrap(err, "failed to respond") } + return nil } @@ -42,7 +43,7 @@ func (h *Handlers) ReadUserByEmail(w http.ResponseWriter, r *http.Request) error wctx := webgo.Context(r) email := wctx.Params()["email"] - out, err := h.api.ReadUserByEmail(r.Context(), email) + out, err := h.apis.ReadUserByEmail(r.Context(), email) if err != nil { return err } diff --git a/cmd/server/http/http.go b/cmd/server/http/http.go new file mode 100644 index 0000000..8e72afe --- /dev/null +++ b/cmd/server/http/http.go @@ -0,0 +1,95 @@ +package http + +import ( + "fmt" + "net/http" + "strconv" + "strings" + "time" + + "github.com/bnkamalesh/goapp/internal/api" + "github.com/bnkamalesh/goapp/internal/pkg/apm" + "github.com/bnkamalesh/webgo/v6" + "github.com/bnkamalesh/webgo/v6/middleware/accesslog" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" +) + +// Config holds all the configuration required to start the HTTP server +type Config struct { + Host string + Port uint16 + + ReadTimeout time.Duration + WriteTimeout time.Duration + DialTimeout time.Duration + + TemplatesBasePath string +} + +type HTTP struct { + apis api.Server + listener string + server *http.Server +} + +// Start starts the HTTP server +func (h *HTTP) Start() error { + webgo.LOGHANDLER.Info("HTTP server, listening on", h.listener) + return h.server.ListenAndServe() +} + +// NewService returns an instance of HTTP with all its dependencies set +func NewService(cfg *Config, apis api.Server) (*HTTP, error) { + home, err := loadHomeTemplate(cfg.TemplatesBasePath) + if err != nil { + return nil, err + } + + handlers := &Handlers{ + apis: apis, + home: home, + } + + router := webgo.NewRouter( + &webgo.Config{ + Host: cfg.Host, + Port: strconv.Itoa(int(cfg.Port)), + ReadTimeout: cfg.ReadTimeout, + WriteTimeout: cfg.WriteTimeout, + ShutdownTimeout: cfg.WriteTimeout * 2, + }, + handlers.routes()..., + ) + + router.Use(accesslog.AccessLog) + router.Use(panicRecoverer) + + // in this app, /-/ prefixed routes are used for healthchecks, readiness checks etc. + _ = otelhttp.WithFilter(func(req *http.Request) bool { + return !strings.HasPrefix(req.URL.Path, "/-/") + }) + + // the span name formatter is used to reduce the cardinality of metrics generated + // when using URIs with variables in it + otelhttp.WithSpanNameFormatter(func(operation string, r *http.Request) string { + wctx := webgo.Context(r) + if wctx == nil { + return r.URL.Path + } + return wctx.Route.Pattern + }) + + httpServer := &http.Server{ + Addr: fmt.Sprintf("%s:%d", cfg.Host, cfg.Port), + Handler: apm.NewHTTPMiddleware()(router), + ReadTimeout: cfg.ReadTimeout, + ReadHeaderTimeout: cfg.ReadTimeout, + WriteTimeout: cfg.WriteTimeout, + IdleTimeout: cfg.ReadTimeout * 2, + } + + return &HTTP{ + server: httpServer, + listener: fmt.Sprintf("%s:%d", cfg.Host, cfg.Port), + }, nil +} diff --git a/cmd/server/http/web/templates/index.html b/cmd/server/http/web/templates/index.html new file mode 100644 index 0000000..cd037b2 --- /dev/null +++ b/cmd/server/http/web/templates/index.html @@ -0,0 +1,41 @@ + + + + Hello world + + + +
+

{{.Message}}

+
+ + diff --git a/cmd/subscribers/kafka/kafka.go b/cmd/subscribers/kafka/kafka.go new file mode 100644 index 0000000..e0c7116 --- /dev/null +++ b/cmd/subscribers/kafka/kafka.go @@ -0,0 +1,13 @@ +package kafka + +import "github.com/bnkamalesh/goapp/internal/api" + +type Kafka struct { + apis api.Subscriber +} + +func New(apis api.Subscriber) *Kafka { + return &Kafka{ + apis: apis, + } +} diff --git a/docker/Dockerfile b/docker/Dockerfile index cfb1170..bb6f37e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20 AS builder +FROM golang:1.21 AS builder COPY ../ /app WORKDIR /app @@ -13,10 +13,10 @@ LABEL MAINTAINER Author # Following commands are for installing CA certs (for proper functioning of HTTPS and other TLS) RUN apt-get update && apt-get install -y --no-install-recommends \ - ca-certificates \ - netbase \ - && rm -rf /var/lib/apt/lists/ \ - && apt-get autoremove -y && apt-get autoclean -y + ca-certificates \ + netbase \ + && rm -rf /var/lib/apt/lists/ \ + && apt-get autoremove -y && apt-get autoclean -y # Add new user 'appuser'. App should be run without root privileges as a security measure RUN adduser --home "/appuser" --disabled-password appuser \ diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 6eebe71..5100910 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -15,12 +15,12 @@ services: - goapp_network goapp: - image: golang:1.20 + image: golang:1.21 volumes: - ${PWD}:/app working_dir: /app - # command: go run main.go tty: true + # command: go run main.go ports: - "8080:8080" depends_on: diff --git a/go.mod b/go.mod index d367b61..2abbdf1 100644 --- a/go.mod +++ b/go.mod @@ -1,42 +1,51 @@ module github.com/bnkamalesh/goapp -go 1.17 +go 1.21 require ( - github.com/Masterminds/squirrel v1.5.3 - github.com/bnkamalesh/errors v0.9.4 + github.com/bnkamalesh/errors v0.11.1 github.com/bnkamalesh/webgo/v6 v6.7.0 - github.com/jackc/pgx/v5 v5.2.0 - github.com/redis/go-redis/v9 v9.0.2 - go.elastic.co/apm v1.15.0 - go.elastic.co/apm/module/apmhttp v1.15.0 + github.com/jackc/pgx/v5 v5.5.3 + github.com/prometheus/client_golang v1.18.0 + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.48.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 + go.opentelemetry.io/contrib/propagators/b3 v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.23.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.23.1 + go.opentelemetry.io/otel/exporters/prometheus v0.45.2 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.23.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.1 + go.opentelemetry.io/otel/metric v1.23.1 + go.opentelemetry.io/otel/sdk v1.23.1 + go.opentelemetry.io/otel/sdk/metric v1.23.1 + go.opentelemetry.io/otel/trace v1.23.1 + golang.org/x/sync v0.6.0 + google.golang.org/grpc v1.61.1 ) require ( - github.com/armon/go-radix v1.0.0 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect - github.com/elastic/go-licenser v0.4.1 // indirect - github.com/elastic/go-sysinfo v1.9.0 // indirect - github.com/elastic/go-windows v1.0.1 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect - github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect - github.com/jackc/puddle/v2 v2.1.2 // indirect - github.com/jcchavezs/porto v0.4.0 // indirect - github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 // indirect - github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect - github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/procfs v0.9.0 // indirect - github.com/santhosh-tekuri/jsonschema v1.2.4 // indirect - go.elastic.co/fastjson v1.1.0 // indirect - go.uber.org/atomic v1.10.0 // indirect - golang.org/x/crypto v0.5.0 // indirect - golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect - golang.org/x/mod v0.7.0 // indirect - golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.4.0 // indirect - golang.org/x/text v0.6.0 // indirect - golang.org/x/tools v0.5.0 // indirect - howett.net/plist v1.0.0 // indirect + github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect + github.com/jackc/puddle/v2 v2.2.1 // indirect + github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/common v0.47.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.1 // indirect + go.opentelemetry.io/proto/otlp v1.1.0 // indirect + golang.org/x/crypto v0.19.0 // indirect + golang.org/x/net v0.21.0 // indirect + golang.org/x/sys v0.17.0 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240213162025-012b6fc9bca9 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9 // indirect + google.golang.org/protobuf v1.32.0 // indirect ) diff --git a/go.sum b/go.sum index b2e42c7..c4b969a 100644 --- a/go.sum +++ b/go.sum @@ -1,182 +1,122 @@ -github.com/Masterminds/squirrel v1.5.3 h1:YPpoceAcxuzIljlr5iWpNKaql7hLeG1KLSrhvdHpkZc= -github.com/Masterminds/squirrel v1.5.3/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10= -github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= -github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/bnkamalesh/errors v0.9.4 h1:wkfw/oq1fUeYfVywrmeWFkOrXNAAcy4/UsC9bf7/ZRw= -github.com/bnkamalesh/errors v0.9.4/go.mod h1:X8+uM23IDiSq8q5kYC3dEP+sMTRlZz0IWFXo7sfrn18= +cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= +cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= +cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= +cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bnkamalesh/errors v0.11.1 h1:lxPIza88BwIf/k8jD1UlQyLS+QzEMCwqM2I6Uo81GVs= +github.com/bnkamalesh/errors v0.11.1/go.mod h1:X8+uM23IDiSq8q5kYC3dEP+sMTRlZz0IWFXo7sfrn18= github.com/bnkamalesh/webgo/v6 v6.7.0 h1:OjS87ncnwzHeWCXyr4TPIOcW4qlNifHiRy7/Kk8VXRA= github.com/bnkamalesh/webgo/v6 v6.7.0/go.mod h1:QHOzBydSNRq5oYWgg9v7A0RIUlyaZeT9nYCx41Sgzd8= -github.com/bsm/ginkgo/v2 v2.5.0 h1:aOAnND1T40wEdAtkGSkvSICWeQ8L3UASX7YVCqQx+eQ= -github.com/bsm/ginkgo/v2 v2.5.0/go.mod h1:AiKlXPm7ItEHNc/2+OkrNG4E0ITzojb9/xWzvQ9XZ9w= -github.com/bsm/gomega v1.20.0 h1:JhAwLmtRzXFTx2AkALSLa8ijZafntmhSoU63Ok18Uq8= -github.com/bsm/gomega v1.20.0/go.mod h1:JifAceMQ4crZIWYUKrlGcmbN3bqHogVTADMD2ATsbwk= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101 h1:7To3pQ+pZo0i3dsWEbinPNFs5gPSBOsJtx3wTT94VBY= +github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/elastic/go-licenser v0.3.1/go.mod h1:D8eNQk70FOCVBl3smCGQt/lv7meBeQno2eI1S5apiHQ= -github.com/elastic/go-licenser v0.4.1 h1:1xDURsc8pL5zYT9R29425J3vkHdt4RT5TNEMeRN48x4= -github.com/elastic/go-licenser v0.4.1/go.mod h1:V56wHMpmdURfibNBggaSBfqgPxyT1Tldns1i87iTEvU= -github.com/elastic/go-sysinfo v1.1.1/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0= -github.com/elastic/go-sysinfo v1.9.0 h1:usICqY/Nw4Mpn9f4LdtpFrKxXroJDe81GaxxUlCckIo= -github.com/elastic/go-sysinfo v1.9.0/go.mod h1:eBD1wEGVaRnRLGecc9iG1z8eOv5HnEdz9+nWd8UAxcE= -github.com/elastic/go-windows v1.0.0/go.mod h1:TsU0Nrp7/y3+VwE82FoZF8gC/XFg/Elz6CcloAxnPgU= -github.com/elastic/go-windows v1.0.1 h1:AlYZOldA+UJ0/2nBuqWdo90GFCgG9xuyw9SYzGUtJm0= -github.com/elastic/go-windows v1.0.1/go.mod h1:FoVvqWSun28vaDQPbj2Elfc0JahhPB7WQEGa3c814Ss= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= +github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 h1:/c3QmbOGMGTOumP2iT/rCwB7b0QDGLKzqOmktBjT+Is= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1/go.mod h1:5SN9VR2LTsRFsrEC6FHgRbTWrTHu6tqPeKxEQv15giM= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= -github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= -github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= -github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= -github.com/jackc/pgx/v5 v5.2.0 h1:NdPpngX0Y6z6XDFKqmFQaE+bCtkqzvQIOt1wvBlAqs8= -github.com/jackc/pgx/v5 v5.2.0/go.mod h1:Ptn7zmohNsWEsdxRawMzk3gaKma2obW+NWTnKa0S4nk= -github.com/jackc/puddle/v2 v2.1.2 h1:0f7vaaXINONKTsxYDn4otOAiJanX/BMeAtY//BXqzlg= -github.com/jackc/puddle/v2 v2.1.2/go.mod h1:2lpufsF5mRHO6SuZkm0fNYxM6SWHfvyFj62KwNzgels= -github.com/jcchavezs/porto v0.1.0/go.mod h1:fESH0gzDHiutHRdX2hv27ojnOVFco37hg1W6E9EZF4A= -github.com/jcchavezs/porto v0.4.0 h1:Zj7RligrxmDdKGo6fBO2xYAHxEgrVBfs1YAja20WbV4= -github.com/jcchavezs/porto v0.4.0/go.mod h1:fESH0gzDHiutHRdX2hv27ojnOVFco37hg1W6E9EZF4A= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 h1:rp+c0RAYOWj8l6qbCUTSiRLG/iKnW3K3/QfPPuSsBt4= -github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901/go.mod h1:Z86h9688Y0wesXCyonoVr47MasHilkuLMqGhRZ4Hpak= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 h1:SOEGU9fKiNWd/HOJuq6+3iTQz8KNCLtVX6idSoTLdUw= -github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o= -github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhRWSsG5rVo6hYhAB/ADZrk= -github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 h1:L0QtFUgDarD7Fpv9jeVMgy/+Ec0mtnmYuImjTz6dtDA= +github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgx/v5 v5.5.3 h1:Ces6/M3wbDXYpM8JyyPD57ivTtJACFZJd885pdIaV2s= +github.com/jackc/pgx/v5 v5.5.3/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A= +github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= +github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/procfs v0.0.0-20190425082905-87a4384529e0/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= -github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= -github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= -github.com/redis/go-redis/v9 v9.0.2 h1:BA426Zqe/7r56kCcvxYLWe1mkaz71LKF77GwgFzSxfE= -github.com/redis/go-redis/v9 v9.0.2/go.mod h1:/xDTe9EF1LM61hek62Poq2nzQSGj0xSrEtEHbBQevps= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/santhosh-tekuri/jsonschema v1.2.4 h1:hNhW8e7t+H1vgY+1QeEQpveR6D4+OwKPXCfD2aieJis= -github.com/santhosh-tekuri/jsonschema v1.2.4/go.mod h1:TEAUOeZSmIxTTuHatJzrvARHiuO9LYd+cIxzgEHCQI4= +github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= +github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= +github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= +github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/common v0.47.0 h1:p5Cz0FNHo7SnWOmWmoRozVcjEp0bIVU8cV7OShpjL1k= +github.com/prometheus/common v0.47.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.elastic.co/apm v1.15.0 h1:uPk2g/whK7c7XiZyz/YCUnAUBNPiyNeE3ARX3G6Gx7Q= -go.elastic.co/apm v1.15.0/go.mod h1:dylGv2HKR0tiCV+wliJz1KHtDyuD8SPe69oV7VyK6WY= -go.elastic.co/apm/module/apmhttp v1.15.0 h1:Le/DhI0Cqpr9wG/NIGOkbz7+rOMqJrfE4MRG6q/+leU= -go.elastic.co/apm/module/apmhttp v1.15.0/go.mod h1:NruY6Jq8ALLzWUVUQ7t4wIzn+onKoiP5woJJdTV7GMg= -go.elastic.co/fastjson v1.1.0 h1:3MrGBWWVIxe/xvsbpghtkFoPciPhOCmjsR/HfwEeQR4= -go.elastic.co/fastjson v1.1.0/go.mod h1:boNGISWMjQsUPy/t6yqt2/1Wx4YNPSe+mZjlyw9vKKI= -go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= -go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE= -golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA= -golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191025021431-6c3a3bfe00ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211102192858-4dd72447c267/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200509030707-2212a7e161a5/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.5.0 h1:+bSpV5HIeWkuvgaMfI3UmKRThoTA5ODJTUd8T17NO+4= -golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.48.0 h1:P+/g8GpuJGYbOp2tAdKrIPUX9JO02q8Q0YNlHolpibA= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.48.0/go.mod h1:tIKj3DbO8N9Y2xo52og3irLsPI4GW02DSMtrVgNMgxg= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 h1:doUP+ExOpH3spVTLS0FcWGLnQrPct/hD/bCPbDRUEAU= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0/go.mod h1:rdENBZMT2OE6Ne/KLwpiXudnAsbdrdBaqBvTN8M8BgA= +go.opentelemetry.io/contrib/propagators/b3 v1.23.0 h1:aaIGWc5JdfRGpCafLRxMJbD65MfTa206AwSKkvGS0Hg= +go.opentelemetry.io/contrib/propagators/b3 v1.23.0/go.mod h1:Gyz7V7XghvwTq+mIhLFlTgcc03UDroOg8vezs4NLhwU= +go.opentelemetry.io/otel v1.23.1 h1:Za4UzOqJYS+MUczKI320AtqZHZb7EqxO00jAHE0jmQY= +go.opentelemetry.io/otel v1.23.1/go.mod h1:Td0134eafDLcTS4y+zQ26GE8u3dEuRBiBCTUIRHaikA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.1 h1:o8iWeVFa1BcLtVEV0LzrCxV2/55tB3xLxADr6Kyoey4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.1/go.mod h1:SEVfdK4IoBnbT2FXNM/k8yC08MrfbhWk3U4ljM8B3HE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.23.1 h1:p3A5+f5l9e/kuEBwLOrnpkIDHQFlHmbiVxMURWRK6gQ= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.23.1/go.mod h1:OClrnXUjBqQbInvjJFjYSnMxBSCXBF8r3b34WqjiIrQ= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.23.1 h1:cfuy3bXmLJS7M1RZmAL6SuhGtKUp2KEsrm00OlAXkq4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.23.1/go.mod h1:22jr92C6KwlwItJmQzfixzQM3oyyuYLCfHiMY+rpsPU= +go.opentelemetry.io/otel/exporters/prometheus v0.45.2 h1:pe2Jqk1K18As0RCw7J08QhgXNqr+6npx0a5W4IgAFA8= +go.opentelemetry.io/otel/exporters/prometheus v0.45.2/go.mod h1:B38pscHKI6bhFS44FDw0eFU3iqG3ASNIvY+fZgR5sAc= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.23.1 h1:C8r95vDR125t815KD+b1tI0Fbc1pFnwHTBxkbIZ6Szc= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.23.1/go.mod h1:Qr0qomr64jentMtOjWMbtYeJMSuMSlsPEjmnRA2sWZ4= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.1 h1:IqmsDcJnxQSs6W+1TMSqpYO7VY4ZuEKJGYlSBPUlT1s= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.1/go.mod h1:VMZ84RYOd4Lrp0+09mckDvqBj2PXWDwOFaxb1P5uO8g= +go.opentelemetry.io/otel/metric v1.23.1 h1:PQJmqJ9u2QaJLBOELl1cxIdPcpbwzbkjfEyelTl2rlo= +go.opentelemetry.io/otel/metric v1.23.1/go.mod h1:mpG2QPlAfnK8yNhNJAxDZruU9Y1/HubbC+KyH8FaCWI= +go.opentelemetry.io/otel/sdk v1.23.1 h1:O7JmZw0h76if63LQdsBMKQDWNb5oEcOThG9IrxscV+E= +go.opentelemetry.io/otel/sdk v1.23.1/go.mod h1:LzdEVR5am1uKOOwfBWFef2DCi1nu3SA8XQxx2IerWFk= +go.opentelemetry.io/otel/sdk/metric v1.23.1 h1:T9/8WsYg+ZqIpMWwdISVVrlGb/N0Jr1OHjR/alpKwzg= +go.opentelemetry.io/otel/sdk/metric v1.23.1/go.mod h1:8WX6WnNtHCgUruJ4TJ+UssQjMtpxkpX0zveQC8JG/E0= +go.opentelemetry.io/otel/trace v1.23.1 h1:4LrmmEd8AU2rFvU1zegmvqW7+kWarxtNOPyeL6HmYY8= +go.opentelemetry.io/otel/trace v1.23.1/go.mod h1:4IpnpJFwr1mo/6HL8XIPJaE9y0+u1KcVmuW7dwFSVrI= +go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxikMeI= +go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/oauth2 v0.16.0 h1:aDkGMBSYxElaoP81NpoUoz2oo2R2wHdZpGToUxfyQrQ= +golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2o= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= +google.golang.org/genproto v0.0.0-20240205150955-31a09d347014 h1:g/4bk7P6TPMkAUbUhquq98xey1slwvuVJPosdBqYJlU= +google.golang.org/genproto v0.0.0-20240205150955-31a09d347014/go.mod h1:xEgQu1e4stdSSsxPDK8Azkrk/ECl5HvdPf6nbZrTS5M= +google.golang.org/genproto/googleapis/api v0.0.0-20240213162025-012b6fc9bca9 h1:4++qSzdWBUy9/2x8L5KZgwZw+mjJZ2yDSCGMVM0YzRs= +google.golang.org/genproto/googleapis/api v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:PVreiBMirk8ypES6aw9d4p6iiBNSIfZEBqr3UGoAi2E= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9 h1:hZB7eLIaYlW9qXRfCq/qDaPdbeY3757uARz5Vvfv+cY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:YUWgXUFRPfoYK1IHMuxH5K6nPEXSCzIMljnQ59lLRCk= +google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY= +google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0= -howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM= -howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g= diff --git a/internal/api/api.go b/internal/api/api.go index ab7bc8d..dc63020 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -1,6 +1,7 @@ package api import ( + "context" "time" "github.com/bnkamalesh/goapp/internal/users" @@ -10,14 +11,25 @@ var ( now = time.Now() ) -// API holds all the dependencies required to expose APIs. And each API is a function with *API as its receiver +// Server has all the methods required to run the server +type Server interface { + CreateUser(ctx context.Context, user *users.User) (*users.User, error) + ReadUserByEmail(ctx context.Context, email string) (*users.User, error) + ServerHealth() (map[string]any, error) +} + +// Subscriber has all the methods required to run the subscriber +type Subscriber interface { + AsyncCreateUsers(ctcx context.Context, users []users.User) error +} + type API struct { users *users.Users } -// Health returns the health of the app along with other info like version -func (a *API) Health() (map[string]interface{}, error) { - return map[string]interface{}{ +// ServerHealth returns the health of the serever app along with other info like version +func (a *API) ServerHealth() (map[string]any, error) { + return map[string]any{ "env": "testing", "version": "v0.1.0", "commit": "", @@ -28,9 +40,18 @@ func (a *API) Health() (map[string]interface{}, error) { } -// NewService returns a new instance of API with all the dependencies initialized -func NewService(us *users.Users) (*API, error) { +func New(us *users.Users) *API { return &API{ users: us, - }, nil + } +} + +func NewServer(us *users.Users) Server { + return &API{ + users: us, + } +} + +func NewSubscriber() Subscriber { + return &API{} } diff --git a/internal/api/users.go b/internal/api/users.go index 8c1c620..55effd3 100644 --- a/internal/api/users.go +++ b/internal/api/users.go @@ -25,3 +25,7 @@ func (a *API) ReadUserByEmail(ctx context.Context, email string) (*users.User, e return u, nil } + +func (a *API) AsyncCreateUsers(ctx context.Context, users []users.User) error { + return a.users.AsyncCreateUsers(ctx, users) +} diff --git a/internal/configs/configs.go b/internal/configs/configs.go index 3d0b628..409cdf5 100644 --- a/internal/configs/configs.go +++ b/internal/configs/configs.go @@ -5,9 +5,7 @@ import ( "strings" "time" - "github.com/bnkamalesh/goapp/internal/pkg/cachestore" - "github.com/bnkamalesh/goapp/internal/pkg/datastore" - "github.com/bnkamalesh/goapp/internal/server/http" + "github.com/bnkamalesh/goapp/cmd/server/http" ) // Configs struct handles all dependencies required for handling configurations @@ -18,52 +16,13 @@ type Configs struct { func (cfg *Configs) HTTP() (*http.Config, error) { return &http.Config{ TemplatesBasePath: strings.TrimSpace(os.Getenv("TEMPLATES_BASEPATH")), - Port: "8080", + Port: 8080, ReadTimeout: time.Second * 5, WriteTimeout: time.Second * 5, DialTimeout: time.Second * 3, }, nil } -// Datastore returns datastore configuration -func (cfg *Configs) Datastore() (*datastore.Config, error) { - return &datastore.Config{ - Host: "postgres", - Port: "5432", - Driver: "postgres", - - StoreName: "goapp", - Username: "gauser", - Password: "gauserpassword", - - SSLMode: "", - - ConnPoolSize: 10, - ReadTimeout: time.Second * 5, - WriteTimeout: time.Second * 5, - IdleTimeout: time.Second * 60, - DialTimeout: time.Second * 10, - }, nil -} - -// Cachestore returns the configuration required for cache -func (cfg *Configs) Cachestore() (*cachestore.Config, error) { - return &cachestore.Config{ - Host: "redis", - Port: 6379, - - DB: 0, - Username: "", - Password: "", - - PoolSize: 8, - IdleTimeout: time.Second * 5, - ReadTimeout: time.Second * 5, - WriteTimeout: time.Second * 5, - DialTimeout: time.Second * 5, - }, nil -} - // New returns an instance of Config with all the required dependencies initialized func New() (*Configs, error) { return &Configs{}, nil diff --git a/internal/notes/notes.go b/internal/notes/notes.go deleted file mode 100644 index d595c2c..0000000 --- a/internal/notes/notes.go +++ /dev/null @@ -1,12 +0,0 @@ -package notes - -import "time" - -// Note represents a single note -type Note struct { - ID string `json:"id,omitempty"` - Title string `json:"title,omitempty"` - Description string `json:"description,omitempty"` - CreatedAt *time.Time `json:"createdAt,omitempty"` - UpdatedAt *time.Time `json:"updatedAt,omitempty"` -} diff --git a/internal/pkg/apm/apm.go b/internal/pkg/apm/apm.go new file mode 100644 index 0000000..b11de11 --- /dev/null +++ b/internal/pkg/apm/apm.go @@ -0,0 +1,235 @@ +// Package apm combines traces/metrics/logs and error aggregators to provide app observability +package apm + +import ( + "context" + "strings" + "time" + + "github.com/bnkamalesh/errors" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" + "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" + "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" + "go.opentelemetry.io/otel/metric" + sdkmetric "go.opentelemetry.io/otel/sdk/metric" + sdktrace "go.opentelemetry.io/otel/sdk/trace" + "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/noop" + "golang.org/x/sync/errgroup" +) + +const shutdownTimeout = 2 * time.Second + +// APM is the application performance monitoring service +type APM struct { + appTracer *Tracer + tracerProvider trace.TracerProvider + + appMeter *Meter + meterProvider metric.MeterProvider +} + +// global apm instance, to simplify code/minimize injections +var ( + global *APM + isGlobalEmpty = true +) + +// Options used for apm initialization +type Options struct { + Debug bool + Environment string + ServiceName string + ServiceVersion string + TracesSampleRate float64 + CollectorURL string + PrometheusScrapePort uint16 + // UseStdOut if true, will set the metrics exporter and trace exporter as stdout + UseStdOut bool +} + +// New initializes APM service using options provided +// It has an internal tracer and meter created for the application +// It can also access the tracerprovider and meteterprovider, so we can integrate otel with other client (redis/kakfa...) +func New(ctx context.Context, opts *Options) (*APM, error) { + s := &APM{} + + tracerProvider, tr, err := newTracer(ctx, opts) + if err != nil { + return nil, err + } + s.tracerProvider = tracerProvider + s.appTracer = tr + + mProvider, m, err := newMeter(opts) + if err != nil { + return nil, err + } + + s.appMeter = m + s.meterProvider = mProvider + SetGlobal(s) + + return s, nil +} + +// Shutdown gracefully switch off apm, flushing any data it have +func (s *APM) Shutdown(ctx context.Context) error { + ctx, cancel := context.WithTimeout(ctx, shutdownTimeout) + defer cancel() + + g := errgroup.Group{} + if s.tracerProvider != nil { + g.Go(func() error { + if tp, ok := s.tracerProvider.(*sdktrace.TracerProvider); ok { + return tp.Shutdown(ctx) + } + return nil + }) + } + + if s.meterProvider != nil { + g.Go(func() error { + if mp, ok := s.meterProvider.(*sdkmetric.MeterProvider); ok { + return mp.Shutdown(ctx) + } + return nil + }) + } + + return g.Wait() +} + +// AppTracer gets provided appTracer for traces +func (s *APM) AppTracer() *Tracer { + if s == nil { + return nil + } + return s.appTracer +} + +// Use this to integrate otel with other client pkg (redis/kafka) +func (s *APM) GetTracerProvider() trace.TracerProvider { + if s.tracerProvider == nil { + return noop.NewTracerProvider() + } + return s.tracerProvider +} + +// Use this to integrate otel with other client pkg (redis/kafka) +func (s *APM) GetMeterProvider() metric.MeterProvider { + if s.meterProvider == nil { + return sdkmetric.NewMeterProvider() + } + return s.meterProvider +} + +// AppMeter gets provided appMeter for metrics +func (s *APM) AppMeter() *Meter { + if s == nil { + return nil + } + return s.appMeter +} + +// SetGlobal sets global apm instance +func SetGlobal(apm *APM) { + /* + when we invoke apm.Global() before we initialize the apm package, Global returns a valid instance + with empty config. But when we initialize with apm.New(), the earlier returned instance of Global() + becomes stale. + + Following implementation would make use of apm.Global() safe from order of execution. + As of now, it's happening in packages like Redis, Mongo, Kafka etc. But in all these cases, + we call Traceprovider/Metricprovider which when there's nothing initialized returns a no-op provider. + And the provider is not updated when we do apm initialize. + TODO: we should be able to update the trace & metric providers even with an out of order initialization + */ + + if global == nil { + global = apm + } else if isGlobalEmpty { + // if isGlobalEmpty is not used, global would be replaced every time New is called + *global = *apm + } + + isGlobalEmpty = false +} + +// Global gets global apm instance +func Global() *APM { + if global == nil { + apm, _ := New(context.Background(), &Options{}) + global = apm + return apm + } + return global +} + +func newMeter(opts *Options) (metric.MeterProvider, *Meter, error) { + exp, err := stdoutmetric.New() + if err != nil { + return nil, nil, errors.Wrap(err, "failed initializing stdout metric exporter") + } + + var mReader sdkmetric.Reader + if opts.UseStdOut { + mReader = sdkmetric.NewPeriodicReader( + exp, + sdkmetric.WithInterval(time.Second*10), + ) + } else { + pexp, err := prometheusExporter() + if err != nil { + return nil, nil, err + } + mReader = pexp + // uncomment below to start prometheusScraper if required + // go prometheusScraper(opts) + } + + return NewMeter( + Options{ + ServiceName: opts.ServiceName, + ServiceVersion: opts.ServiceVersion, + }, + mReader, + ) +} + +func newTracer(ctx context.Context, opts *Options) (trace.TracerProvider, *Tracer, error) { + var ( + exporter sdktrace.SpanExporter + err error + ) + + httpCollector := false + if opts.CollectorURL == "" { + opts.UseStdOut = true + } else { + httpCollector = strings.HasPrefix(opts.CollectorURL, "http") + } + + if opts.UseStdOut { + exporter, err = stdouttrace.New() + } else if httpCollector { + exporter, err = otlptracehttp.New( + ctx, + otlptracehttp.WithEndpoint(opts.CollectorURL), + otlptracehttp.WithInsecure(), + ) + } else { + exporter, err = otlptracegrpc.New( + ctx, + otlptracegrpc.WithEndpoint(opts.CollectorURL), + otlptracegrpc.WithInsecure(), + ) + } + if err != nil { + return nil, nil, errors.Wrap(err, "failed to initialize trace exporter") + } + + tp, t := NewTracer(ctx, opts, exporter) + return tp, t, nil +} diff --git a/internal/pkg/apm/grpc_util.go b/internal/pkg/apm/grpc_util.go new file mode 100644 index 0000000..c02d15f --- /dev/null +++ b/internal/pkg/apm/grpc_util.go @@ -0,0 +1,92 @@ +package apm + +import ( + "fmt" + "time" + + "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/keepalive" +) + +func OtelGrpcStreamInterceptor(ignoredMethods ...string) grpc.StreamServerInterceptor { + checkList := map[string]struct{}{} + for _, m := range ignoredMethods { + checkList[m] = struct{}{} + } + return otelgrpc.StreamServerInterceptor( + otelgrpc.WithInterceptorFilter(func(info *otelgrpc.InterceptorInfo) bool { + _, ignored := checkList[info.Method] + return !ignored + }), + otelgrpc.WithTracerProvider(Global().GetTracerProvider()), + otelgrpc.WithMeterProvider(Global().GetMeterProvider()), + ) +} + +func OtelGrpcUnaryInterceptor(ignoredMethods ...string) grpc.UnaryServerInterceptor { + checkList := map[string]struct{}{} + for _, m := range ignoredMethods { + checkList[m] = struct{}{} + } + return otelgrpc.UnaryServerInterceptor( + otelgrpc.WithInterceptorFilter(func(info *otelgrpc.InterceptorInfo) bool { + _, ignored := checkList[info.Method] + return !ignored + }), + otelgrpc.WithTracerProvider(Global().GetTracerProvider()), + otelgrpc.WithMeterProvider(Global().GetMeterProvider()), + ) +} + +func OtelGrpcClientStreamInterceptor(ignoredMethods ...string) grpc.StreamClientInterceptor { + checkList := map[string]struct{}{} + for _, m := range ignoredMethods { + checkList[m] = struct{}{} + } + + return otelgrpc.StreamClientInterceptor( + otelgrpc.WithInterceptorFilter(func(info *otelgrpc.InterceptorInfo) bool { + _, ignored := checkList[info.Method] + return !ignored + }), + otelgrpc.WithTracerProvider(Global().GetTracerProvider()), + otelgrpc.WithMeterProvider(Global().GetMeterProvider()), + ) +} + +func OtelGrpcClientUnaryInterceptor(ignoredMethods ...string) grpc.UnaryClientInterceptor { + checkList := map[string]struct{}{} + for _, m := range ignoredMethods { + checkList[m] = struct{}{} + } + + return otelgrpc.UnaryClientInterceptor( + otelgrpc.WithInterceptorFilter(func(info *otelgrpc.InterceptorInfo) bool { + _, ignored := checkList[info.Method] + return !ignored + }), + otelgrpc.WithTracerProvider(Global().GetTracerProvider()), + otelgrpc.WithMeterProvider(Global().GetMeterProvider()), + ) +} + +func NewGrpcClient(address string, port int) (*grpc.ClientConn, error) { + dialOpts := []grpc.DialOption{ + grpc.WithUnaryInterceptor(OtelGrpcClientUnaryInterceptor()), + grpc.WithStreamInterceptor(OtelGrpcClientStreamInterceptor()), + grpc.WithKeepaliveParams(keepalive.ClientParameters{ + Time: 30 * time.Second, + Timeout: 10 * time.Second, + PermitWithoutStream: true, + }), + grpc.WithTransportCredentials(insecure.NewCredentials()), + } + + conn, err := grpc.Dial(fmt.Sprintf("%s:%d", address, port), dialOpts...) + if err != nil { + return nil, fmt.Errorf("failed to create new gRPC client: %w", err) + } + return conn, err +} diff --git a/internal/pkg/apm/http.go b/internal/pkg/apm/http.go new file mode 100644 index 0000000..012b699 --- /dev/null +++ b/internal/pkg/apm/http.go @@ -0,0 +1,24 @@ +package apm + +import ( + "net/http" + + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" +) + +type HTTPMiddleware func(h http.Handler) http.Handler + +func NewHTTPMiddleware(opts ...otelhttp.Option) HTTPMiddleware { + if len(opts) == 0 { + opts = make([]otelhttp.Option, 0, 3) + } + gb := Global() + opts = append(opts, + otelhttp.WithMeterProvider(gb.GetMeterProvider()), + otelhttp.WithTracerProvider(gb.GetTracerProvider()), + ) + + return func(h http.Handler) http.Handler { + return otelhttp.NewHandler(h, "otelhttp", opts...) + } +} diff --git a/internal/pkg/apm/meter.go b/internal/pkg/apm/meter.go new file mode 100644 index 0000000..d5f3fe8 --- /dev/null +++ b/internal/pkg/apm/meter.go @@ -0,0 +1,128 @@ +package apm + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/sdk/instrumentation" + sdkmetric "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/resource" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" +) + +var ( + // TimeBucketsFast suits if expected response time is very high: 1ms..100ms + // This buckets suits for cache storages (in-memory cache, Memcache, Redis) + TimeBucketsFast = []float64{1, 3, 7, 15, 50, 100, 200, 500, 1000, 2000, 5000} + + // TimeBucketsMedium suits for most of GO APIs, where response time is between 50ms..500ms. + // Works for wide range of systems because provides near-logarithmic buckets distribution. + TimeBucketsMedium = []float64{1, 5, 15, 50, 100, 250, 500, 750, 1000, 1500, 2000, 3500, 5000} + + // TimeBucketsSlow suits for relatively slow services, where expected response time is > 500ms. + TimeBucketsSlow = []float64{50, 100, 200, 500, 750, 1000, 1250, 1500, 1750, 2000, 2500, 3000, 4000, 5000} +) + +// Meter - metric service +type Meter struct { + metric.Meter +} + +// CounterAdd lazily increments certain counter metric. The label set passed on the first time should +// be present every time, no sparse keys +func (m *Meter) CounterAdd(ctx context.Context, name string, amount float64, attrs ...attribute.KeyValue) { + counter, err := m.Float64Counter(name) + if err != nil { + return + } + counter.Add(ctx, amount, metric.WithAttributes(attrs...)) +} + +// HistogramRecord records value to histogram with predefined boundaries (e.g. request latency) +// The same rules apply as for counter - no sparse label structure +func (m *Meter) HistogramRecord(ctx context.Context, name string, value float64, attrs ...attribute.KeyValue) { + histogram, err := m.Float64Histogram(name) + if err != nil { + return + } + histogram.Record(ctx, value, metric.WithAttributes(attrs...)) +} + +// Observe function collect will be called each time the metric is scraped, it should be go-routine safe +func (m *Meter) Observe(name string, collect func() float64, attrs ...attribute.KeyValue) { + gauge, err := m.Float64ObservableGauge(name) + if err != nil { + return + } + _, err = m.RegisterCallback(func(_ context.Context, o metric.Observer) error { + o.ObserveFloat64(gauge, collect(), metric.WithAttributes(attrs...)) + return nil + }, gauge) + if err != nil { + return + } +} + +// NewMeter create a global meter provider and a custom meter obj for the application's own usage +// we need both obj because the provider helps us integrate with other third party sdk like redis/kafka +func NewMeter(config Options, reader sdkmetric.Reader) (metric.MeterProvider, *Meter, error) { + // to avoid high cardinality https://github.com/open-telemetry/opentelemetry-go-contrib/issues/3071 + provider := sdkmetric.NewMeterProvider( + sdkmetric.WithReader(reader), + sdkmetric.WithView(customViews()...), + sdkmetric.WithResource(resource.NewWithAttributes( + "", + semconv.ServiceNameKey.String(config.ServiceName), + semconv.ServiceVersionKey.String(config.ServiceVersion), + ), + ), + ) + + meter := provider.Meter("") + return provider, &Meter{ + Meter: meter, + }, nil +} + +func allowedAttr(v ...string) attribute.Filter { + m := make(map[string]struct{}, len(v)) + for _, s := range v { + m[s] = struct{}{} + } + return func(kv attribute.KeyValue) bool { + _, ok := m[string(kv.Key)] + return ok + } +} + +// Some metrics from otel pkg has high cardinality attributes, use this to filter out necessary attribute only +func customViews() []sdkmetric.View { + return []sdkmetric.View{ + sdkmetric.NewView( + sdkmetric.Instrument{ + Scope: instrumentation.Scope{ + Name: "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp", + }, + }, + sdkmetric.Stream{ + AttributeFilter: allowedAttr( + "http.method", + "http.status_code", + "http.target", + ), + }, + ), + sdkmetric.NewView( + sdkmetric.Instrument{ + Scope: instrumentation.Scope{ + Name: "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc", + }, + }, + sdkmetric.Stream{ + AttributeFilter: allowedAttr( + "rpc.service", "rpc.method", "rpc.grpc.status_code"), + }, + ), + } +} diff --git a/internal/pkg/apm/prometheus.go b/internal/pkg/apm/prometheus.go new file mode 100644 index 0000000..ad98229 --- /dev/null +++ b/internal/pkg/apm/prometheus.go @@ -0,0 +1,47 @@ +package apm + +import ( + "fmt" + "net/http" + "time" + + "github.com/bnkamalesh/errors" + "github.com/prometheus/client_golang/prometheus/promhttp" + "go.opentelemetry.io/otel/exporters/prometheus" +) + +func prometheusExporter() (*prometheus.Exporter, error) { + exporter, err := prometheus.New() + if err != nil { + return nil, errors.Wrap(err, "promexporter.New") + } + + return exporter, nil +} + +func prometheusScraper(opts *Options) { + mux := http.NewServeMux() + mux.Handle("/-/metrics", promhttp.Handler()) + server := &http.Server{ + Handler: mux, + Addr: fmt.Sprintf("%d", opts.PrometheusScrapePort), + ReadHeaderTimeout: 5 * time.Second, + } + + // logger.Info( + // "[otel/http] starting prometheus scrape endpoint", + // zap.String( + // "addr", + // fmt.Sprintf("localhost:%d/-/metrics", opts.PrometheusScrapePort), + // ), + // ) + err := server.ListenAndServe() + if err != nil { + // logger.Error( + // "[otel/http] failed to serve metrics at:", + // zap.Error(err), + // zap.Uint16("port", opts.PrometheusScrapePort), + // ) + return + } +} diff --git a/internal/pkg/apm/tracer.go b/internal/pkg/apm/tracer.go new file mode 100644 index 0000000..8b32048 --- /dev/null +++ b/internal/pkg/apm/tracer.go @@ -0,0 +1,53 @@ +package apm + +import ( + "context" + "fmt" + + "go.opentelemetry.io/contrib/propagators/b3" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/sdk/resource" + sdktrace "go.opentelemetry.io/otel/sdk/trace" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + "go.opentelemetry.io/otel/trace" +) + +const environmentLabel = "environment" + +// Tracer represents common wrapper on any customTracer +type Tracer struct { + // So far no custom behavior, export all sdk for convenience + trace.Tracer +} + +// New create a global tracerProvider and a custom tracer for the application own usage +// we need both obj because tracerProvider is the way to integrate with other otel sdk +func NewTracer(ctx context.Context, opts *Options, exporter sdktrace.SpanExporter) (trace.TracerProvider, *Tracer) { + s := &Tracer{} + + batchProcessor := sdktrace.NewBatchSpanProcessor(exporter) + sampler := sdktrace.ParentBased(sdktrace.TraceIDRatioBased(opts.TracesSampleRate)) + tp := sdktrace.NewTracerProvider( + sdktrace.WithSampler(sampler), + sdktrace.WithSpanProcessor(batchProcessor), + sdktrace.WithResource(resource.NewWithAttributes( + semconv.SchemaURL, + semconv.ServiceNameKey.String(opts.ServiceName), + semconv.ServiceVersionKey.String(opts.ServiceVersion), + attribute.String(environmentLabel, opts.Environment), + )), + ) + otel.SetTracerProvider(tp) + + propagator := propagation.NewCompositeTextMapPropagator( + propagation.TraceContext{}, + b3.New(b3.WithInjectEncoding(b3.B3SingleHeader|b3.B3MultipleHeader)), // For Istio compatibility + ) + otel.SetTextMapPropagator(propagator) + + s.Tracer = tp.Tracer(fmt.Sprintf("%s:tracer", opts.ServiceName)) + + return tp, s +} diff --git a/internal/pkg/cachestore/cachestore.go b/internal/pkg/cachestore/cachestore.go deleted file mode 100644 index 20283c4..0000000 --- a/internal/pkg/cachestore/cachestore.go +++ /dev/null @@ -1,54 +0,0 @@ -package cachestore - -import ( - "context" - "fmt" - "time" - - "github.com/bnkamalesh/errors" - "github.com/redis/go-redis/v9" -) - -var ( - // ErrCacheMiss is the error returned when the requested item is not available in cache - ErrCacheMiss = errors.NotFound("not found in cache") - // ErrCacheNotInitialized is the error returned when the cache handler is not initialized - ErrCacheNotInitialized = errors.New("not initialized") -) - -// Config holds all the configuration required for this package -type Config struct { - Host string - Port int - - DB int - Username string - Password string - - PoolSize int - IdleTimeout time.Duration - ReadTimeout time.Duration - WriteTimeout time.Duration - DialTimeout time.Duration -} - -func New(cfg *Config) (*redis.Client, error) { - cli := redis.NewClient( - &redis.Options{ - Addr: fmt.Sprintf("%s:%d", cfg.Host, cfg.Port), - Username: cfg.Username, - Password: cfg.Password, - DB: cfg.DB, - DialTimeout: cfg.DialTimeout, - ReadTimeout: cfg.ReadTimeout, - WriteTimeout: cfg.WriteTimeout, - ConnMaxIdleTime: cfg.IdleTimeout, - PoolSize: cfg.PoolSize, - }, - ) - err := cli.Ping(context.Background()).Err() - if err != nil { - return nil, errors.Wrap(err, "failed to ping") - } - return cli, nil -} diff --git a/internal/pkg/logger/default.go b/internal/pkg/logger/default.go index 85b0976..443fe9e 100644 --- a/internal/pkg/logger/default.go +++ b/internal/pkg/logger/default.go @@ -1,24 +1,26 @@ package logger +import "context" + var defaultLogger = New("", "", 0) // Info is for logging items with severity 'info' -func Info(payload ...interface{}) error { +func Info(ctx context.Context, payload ...interface{}) error { return defaultLogger.log(LogTypeInfo, payload...) } // Warn is for logging items with severity 'Warn' -func Warn(payload ...interface{}) error { +func Warn(ctx context.Context, payload ...interface{}) error { return defaultLogger.log(LogTypeWarn, payload...) } // Error is for logging items with severity 'Error' -func Error(payload ...interface{}) error { +func Error(ctx context.Context, payload ...interface{}) error { return defaultLogger.log(LogTypeError, payload...) } // Fatal is for logging items with severity 'Fatal' -func Fatal(payload ...interface{}) error { +func Fatal(ctx context.Context, payload ...interface{}) error { return defaultLogger.log(LogTypeFatal, payload...) } diff --git a/internal/pkg/logger/logger.go b/internal/pkg/logger/logger.go index 12afc14..45d9e3d 100644 --- a/internal/pkg/logger/logger.go +++ b/internal/pkg/logger/logger.go @@ -4,6 +4,7 @@ package logger import ( + "context" "encoding/json" "fmt" "os" @@ -24,10 +25,10 @@ const ( // Logger interface defines all the logging methods to be implemented type Logger interface { - Info(payload ...interface{}) error - Warn(payload ...interface{}) error - Error(payload ...interface{}) error - Fatal(payload ...interface{}) error + Info(ctx context.Context, payload ...interface{}) error + Warn(ctx context.Context, payload ...interface{}) error + Error(ctx context.Context, payload ...interface{}) error + Fatal(ctx context.Context, payload ...interface{}) error } // LogHandler implements Logger diff --git a/internal/pkg/datastore/datastore.go b/internal/pkg/postgres/postgres.go similarity index 98% rename from internal/pkg/datastore/datastore.go rename to internal/pkg/postgres/postgres.go index b3591a5..e9fee84 100644 --- a/internal/pkg/datastore/datastore.go +++ b/internal/pkg/postgres/postgres.go @@ -1,4 +1,4 @@ -package datastore +package postgres import ( "context" diff --git a/internal/pkg/sysignals/sysignals.go b/internal/pkg/sysignals/sysignals.go new file mode 100644 index 0000000..47de8ce --- /dev/null +++ b/internal/pkg/sysignals/sysignals.go @@ -0,0 +1,35 @@ +package sysignals + +import ( + "os" + "os/signal" + "syscall" + + "github.com/bnkamalesh/errors" +) + +var ( + ErrSigQuit = errors.New("received terminal signal") +) + +// NotifyErrorOnQuit creates an error upon receiving any of the os signal, to quit the app. +// The error is then pushed to the channel +func NotifyErrorOnQuit(errs chan<- error, otherSignals ...syscall.Signal) { + interrupt := make(chan os.Signal, 1) + signal.Notify(interrupt) + + for signalType := range interrupt { + switch signalType { + case syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGTSTP: + errs <- errors.Wrapf(ErrSigQuit, "%v", signalType) + return + } + + for _, oSignal := range otherSignals { + if oSignal == signalType { + errs <- errors.Wrapf(ErrSigQuit, "%v", signalType) + return + } + } + } +} diff --git a/internal/server/http/http.go b/internal/server/http/http.go deleted file mode 100644 index 3fc7c81..0000000 --- a/internal/server/http/http.go +++ /dev/null @@ -1,85 +0,0 @@ -package http - -import ( - "fmt" - "net/http" - "time" - - "github.com/bnkamalesh/webgo/v6" - "github.com/bnkamalesh/webgo/v6/middleware/accesslog" - "go.elastic.co/apm" - "go.elastic.co/apm/module/apmhttp" - - "github.com/bnkamalesh/goapp/internal/api" -) - -// HTTP struct holds all the dependencies required for starting HTTP server -type HTTP struct { - server *http.Server - cfg *Config -} - -// Start starts the HTTP server -func (h *HTTP) Start() error { - webgo.LOGHANDLER.Info("HTTP server, listening on", h.cfg.Host, h.cfg.Port) - return h.server.ListenAndServe() -} - -// Config holds all the configuration required to start the HTTP server -type Config struct { - Host string - Port string - TemplatesBasePath string - ReadTimeout time.Duration - WriteTimeout time.Duration - DialTimeout time.Duration -} - -// NewService returns an instance of HTTP with all its dependencies set -func NewService(cfg *Config, a *api.API) (*HTTP, error) { - home, err := loadHomeTemplate(cfg.TemplatesBasePath) - if err != nil { - return nil, err - } - - h := &Handlers{ - api: a, - home: home, - } - - router := webgo.NewRouter( - &webgo.Config{ - Host: cfg.Host, - Port: cfg.Port, - ReadTimeout: cfg.ReadTimeout, - WriteTimeout: cfg.WriteTimeout, - ShutdownTimeout: cfg.WriteTimeout * 2, - }, - h.routes()..., - ) - - router.Use(accesslog.AccessLog) - router.Use(panicRecoverer) - tracer, _ := apm.NewTracer("goapp", "v1.1.3") - - serverHandler := apmhttp.Wrap( - router, - apmhttp.WithRecovery(apmhttp.NewTraceRecovery( - tracer, - )), - ) - - httpServer := &http.Server{ - Addr: fmt.Sprintf("%s:%s", cfg.Host, cfg.Port), - Handler: serverHandler, - ReadTimeout: cfg.ReadTimeout, - ReadHeaderTimeout: cfg.ReadTimeout, - WriteTimeout: cfg.WriteTimeout, - IdleTimeout: cfg.ReadTimeout * 2, - } - - return &HTTP{ - server: httpServer, - cfg: cfg, - }, nil -} diff --git a/internal/server/http/web/templates/index.html b/internal/server/http/web/templates/index.html deleted file mode 100644 index dca6dd7..0000000 --- a/internal/server/http/web/templates/index.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - Hello world - - - -
- {{.Message}} -
- - diff --git a/internal/users/cache.go b/internal/users/cache.go deleted file mode 100644 index 58e4f25..0000000 --- a/internal/users/cache.go +++ /dev/null @@ -1,84 +0,0 @@ -package users - -import ( - "context" - "encoding/json" - "fmt" - "time" - - "github.com/bnkamalesh/errors" - "github.com/redis/go-redis/v9" - - "github.com/bnkamalesh/goapp/internal/pkg/cachestore" -) - -type usercache struct { - cli *redis.Client -} - -func (uc *usercache) conn(ctx context.Context) (*redis.Conn, error) { - return uc.cli.Conn(), nil -} - -func userCacheKey(id string) string { - return fmt.Sprintf("user-%s", id) -} - -func (uc *usercache) SetUser(ctx context.Context, email string, u *User) error { - if uc.cli == nil { - return cachestore.ErrCacheNotInitialized - } - - conn, err := uc.conn(ctx) - if err != nil { - return errors.InternalErr(err, errors.DefaultMessage) - } - - // it is safe to ignore error here because User struct has no field which can cause the marshal to fail - payload, _ := json.Marshal(u) - - key := userCacheKey(email) - - err = conn.Set(ctx, key, payload, time.Hour).Err() - if err != nil { - return errors.InternalErr(err, errors.DefaultMessage) - } - - return nil -} - -func (uc *usercache) ReadUserByEmail(ctx context.Context, email string) (*User, error) { - if uc.cli == nil { - return nil, cachestore.ErrCacheNotInitialized - } - - conn, err := uc.conn(ctx) - if err != nil { - return nil, errors.InternalErr(err, errors.DefaultMessage) - } - - key := userCacheKey(email) - - cmd := conn.Get(ctx, key) - payload, err := cmd.Bytes() - if err != nil { - return nil, errors.Wrap(err, errors.DefaultMessage) - } - if payload == nil { - return nil, cachestore.ErrCacheMiss - } - - u := new(User) - err = json.Unmarshal(payload, u) - if err != nil { - return nil, errors.InternalErr(err, errors.DefaultMessage) - } - - return u, nil -} - -func NewCacheStore(cli *redis.Client) (*usercache, error) { - return &usercache{ - cli: cli, - }, nil -} diff --git a/internal/users/store.go b/internal/users/store.go deleted file mode 100644 index f02ed2e..0000000 --- a/internal/users/store.go +++ /dev/null @@ -1,100 +0,0 @@ -package users - -import ( - "context" - "database/sql" - "strings" - - "github.com/Masterminds/squirrel" - "github.com/bnkamalesh/errors" - "github.com/jackc/pgx/v5" - "github.com/jackc/pgx/v5/pgxpool" -) - -type userStore struct { - qbuilder squirrel.StatementBuilderType - pqdriver *pgxpool.Pool - tableName string -} - -func (us *userStore) Create(ctx context.Context, u *User) error { - query, args, err := us.qbuilder.Insert(us.tableName).SetMap(map[string]interface{}{ - "firstName": u.FirstName, - "lastName": u.LastName, - "mobile": u.Mobile, - "email": u.Email, - "createdAt": u.CreatedAt, - "updatedAt": u.UpdatedAt, - }).ToSql() - if err != nil { - return errors.InternalErr(err, errors.DefaultMessage) - } - - _, err = us.pqdriver.Exec(ctx, query, args...) - if err != nil { - if strings.Contains(err.Error(), "violates unique constraint") { - return errors.DuplicateErrf(err, "user with email '%s' already exists", u.Email) - } - return errors.InternalErr(err, errors.DefaultMessage) - } - - return nil -} - -func (us *userStore) ReadByEmail(ctx context.Context, email string) (*User, error) { - query, args, err := us.qbuilder.Select( - "firstName", - "lastName", - "mobile", - "email", - "createdAt", - "updatedAt", - ).From( - us.tableName, - ).Where( - squirrel.Eq{ - "email": email, - }, - ).ToSql() - if err != nil { - return nil, errors.InternalErr(err, errors.DefaultMessage) - } - - user := new(User) - firstName := new(sql.NullString) - lastName := new(sql.NullString) - mobile := new(sql.NullString) - storeEmail := new(sql.NullString) - - row := us.pqdriver.QueryRow(ctx, query, args...) - err = row.Scan( - firstName, - lastName, - mobile, - storeEmail, - &user.CreatedAt, - &user.UpdatedAt, - ) - if err != nil { - if errors.Is(err, pgx.ErrNoRows) { - return nil, errors.NotFoundErrf(err, "user with email '%s' not found", email) - } - - return nil, errors.InternalErr(err, errors.DefaultMessage) - } - - user.FirstName = firstName.String - user.LastName = lastName.String - user.Mobile = mobile.String - user.Email = storeEmail.String - - return user, nil -} - -func NewStore(pqdriver *pgxpool.Pool) (*userStore, error) { - return &userStore{ - pqdriver: pqdriver, - qbuilder: squirrel.StatementBuilder.PlaceholderFormat(squirrel.Dollar), - tableName: "Users", - }, nil -} diff --git a/internal/users/users.go b/internal/users/users.go index 9425eb2..e7f76e9 100644 --- a/internal/users/users.go +++ b/internal/users/users.go @@ -3,145 +3,82 @@ package users import ( "context" "strings" - "time" "github.com/bnkamalesh/errors" - - "github.com/bnkamalesh/goapp/internal/pkg/cachestore" - "github.com/bnkamalesh/goapp/internal/pkg/logger" ) -// User holds all data required to represent a user type User struct { - FirstName string `json:"firstName,omitempty"` - LastName string `json:"lastName,omitempty"` - Mobile string `json:"mobile,omitempty"` - Email string `json:"email,omitempty"` - CreatedAt *time.Time `json:"createdAt,omitempty"` - UpdatedAt *time.Time `json:"updatedAt,omitempty"` -} - -func (u *User) setDefaults() { - now := time.Now() - if u.CreatedAt == nil { - u.CreatedAt = &now - } - - if u.UpdatedAt == nil { - u.UpdatedAt = &now - } + ID string + Name string + Address string + Phone string } -// Sanitize is used to sanitize/cleanup the fields of User -func (u *User) Sanitize() { - u.FirstName = strings.TrimSpace(u.FirstName) - u.LastName = strings.TrimSpace(u.LastName) - u.Email = strings.TrimSpace(u.Email) - u.Mobile = strings.TrimSpace(u.Mobile) -} - -// Validate is used to validate the fields of User -func (u *User) Validate() error { - if u.Email == "" { - return nil +// ValidateForCreate runs the validation required for when a user is being created. i.e. ID is not available +func (us *User) ValidateForCreate() error { + if us.Name == "" { + return errors.Validation("name cannot be empty") } - err := validateEmail(u.Email) - if err != nil { - return err + if us.Phone == "" { + return errors.Validation("phone number cannot be empty") } return nil } -func validateEmail(email string) error { - parts := strings.Split(email, "@") - if len(parts) != 2 { - return errors.Validation("invalid email address provided") - } - - return nil +func (us *User) Sanitize() { + us.ID = strings.TrimSpace(us.ID) + us.Name = strings.TrimSpace(us.Name) + us.Address = strings.TrimSpace(us.Address) + us.Phone = strings.TrimSpace(us.Phone) } -type userCachestore interface { - SetUser(ctx context.Context, email string, u *User) error - ReadUserByEmail(ctx context.Context, email string) (*User, error) -} type store interface { - Create(ctx context.Context, u *User) error - ReadByEmail(ctx context.Context, email string) (*User, error) + GetUserByEmail(ctx context.Context, email string) (*User, error) + SaveUser(ctx context.Context, user *User) (string, error) + BulkSaveUser(ctx context.Context, users []User) error } - -// Users struct holds all the dependencies required for the users package. And exposes all services -// provided by this package as its methods type Users struct { - logHandler logger.Logger - cachestore userCachestore - store store + store store } -// CreateUser creates a new user -func (us *Users) CreateUser(ctx context.Context, u *User) (*User, error) { - u.setDefaults() - u.Sanitize() - - err := u.Validate() +func (us *Users) CreateUser(ctx context.Context, user *User) (*User, error) { + user.Sanitize() + err := user.ValidateForCreate() if err != nil { return nil, err } - err = us.store.Create(ctx, u) + newID, err := us.store.SaveUser(ctx, user) if err != nil { return nil, err } + user.ID = newID - return u, nil + return user, nil } -// ReadByEmail returns a user which matches the given email func (us *Users) ReadByEmail(ctx context.Context, email string) (*User, error) { - email = strings.TrimSpace(email) - err := validateEmail(email) - if err != nil { - return nil, err + if email == "" { + return nil, errors.Validation("no email provided") } - u, err := us.cachestore.ReadUserByEmail(ctx, email) - if err != nil && - !errors.Is(err, cachestore.ErrCacheMiss) && - !errors.Is(err, cachestore.ErrCacheNotInitialized) { - // caches are usually read-through, i.e. in case of error, just log and continue to fetch from - // primary datastore - _ = us.logHandler.Error(err.Error()) - } else if err == nil { - return u, nil - } + return us.store.GetUserByEmail(ctx, email) +} - u, err = us.store.ReadByEmail(ctx, email) - if err != nil { - return nil, err +func (us *Users) AsyncCreateUsers(ctx context.Context, users []User) error { + errList := make([]error, 0, len(users)) + for i := range users { + err := users[i].ValidateForCreate() + if err != nil { + errList = append(errList, err) + } } - err = us.cachestore.SetUser(ctx, u.Email, u) - if err != nil { - // in case of error while storing in cache, it is only logged - // This behaviour as well as read-through cache behaviour depends on your business logic. - _ = us.logHandler.Error(err.Error()) + if len(errList) != 0 { + return errors.Join(errList...) } - return u, nil -} - -// NewService initializes the Users struct with all its dependencies and returns a new instance -// all dependencies of Users should be sent as arguments of NewService -func NewService( - l logger.Logger, - persistenceStore store, - cacheStore userCachestore, -) (*Users, error) { - return &Users{ - logHandler: l, - cachestore: cacheStore, - store: persistenceStore, - }, nil + return us.store.BulkSaveUser(ctx, users) } diff --git a/internal/users/users_test.go b/internal/users/users_test.go deleted file mode 100644 index ce13d5d..0000000 --- a/internal/users/users_test.go +++ /dev/null @@ -1,118 +0,0 @@ -package users - -import ( - "reflect" - "strings" - "testing" - "time" -) - -func TestUser_Sanitize(t *testing.T) { - type fields struct { - FirstName string - LastName string - Mobile string - Email string - CreatedAt *time.Time - UpdatedAt *time.Time - } - tests := []struct { - name string - fields fields - }{ - { - name: "valid values", - fields: fields{ - FirstName: "Jane", - LastName: "Doe", - Mobile: "9876543210", - Email: "jane.doe@example.com", - }, - }, - { - name: "with leading & trailing whitespaces", - fields: fields{ - FirstName: "Jane ", - LastName: " Doe ", - Mobile: " 9876543210", - Email: " jane.doe@example.com ", - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - u := &User{ - FirstName: tt.fields.FirstName, - LastName: tt.fields.LastName, - Mobile: tt.fields.Mobile, - Email: tt.fields.Email, - CreatedAt: tt.fields.CreatedAt, - UpdatedAt: tt.fields.UpdatedAt, - } - u.Sanitize() - - trimmed := &User{ - FirstName: strings.TrimSpace(u.FirstName), - LastName: strings.TrimSpace(u.LastName), - Mobile: strings.TrimSpace(u.Mobile), - Email: strings.TrimSpace(u.Email), - } - - if !reflect.DeepEqual(u, trimmed) { - t.Fatalf("expected all trimmed values, got %v", u) - } - }) - } -} - -func TestUser_Validate(t *testing.T) { - type fields struct { - FirstName string - LastName string - Mobile string - Email string - CreatedAt *time.Time - UpdatedAt *time.Time - } - tests := []struct { - name string - fields fields - wantErr bool - }{ - { - name: "all valid", - fields: fields{ - FirstName: "Jane", - LastName: "Doe", - Mobile: "9876543210", - Email: "jane.doe@example.com", - }, - wantErr: false, - }, - { - name: "invalid email", - fields: fields{ - FirstName: "Jane", - LastName: "Doe", - Mobile: "9876543210", - Email: "jane.doeexample.com", - }, - wantErr: true, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - u := &User{ - FirstName: tt.fields.FirstName, - LastName: tt.fields.LastName, - Mobile: tt.fields.Mobile, - Email: tt.fields.Email, - CreatedAt: tt.fields.CreatedAt, - UpdatedAt: tt.fields.UpdatedAt, - } - if err := u.Validate(); (err != nil) != tt.wantErr { - t.Errorf("User.Validate() error = %v, wantErr %v", err, tt.wantErr) - } - }) - } -} diff --git a/main.go b/main.go index ec53c4b..0513f82 100644 --- a/main.go +++ b/main.go @@ -1,90 +1,111 @@ package main import ( + "context" + "errors" "fmt" + "os" + "sync" + "time" + "github.com/bnkamalesh/goapp/cmd/server/grpc" + "github.com/bnkamalesh/goapp/cmd/server/http" "github.com/bnkamalesh/goapp/internal/api" "github.com/bnkamalesh/goapp/internal/configs" - "github.com/bnkamalesh/goapp/internal/pkg/cachestore" - "github.com/bnkamalesh/goapp/internal/pkg/datastore" + "github.com/bnkamalesh/goapp/internal/pkg/apm" "github.com/bnkamalesh/goapp/internal/pkg/logger" - "github.com/bnkamalesh/goapp/internal/server/http" - "github.com/bnkamalesh/goapp/internal/users" + "github.com/bnkamalesh/goapp/internal/pkg/sysignals" ) -func main() { - l := logger.New("goapp", "v1.0.0", 1) - logger.UpdateDefaultLogger(l) +// recoverer is used for panic recovery of the application (note: this is not for the HTTP/gRPC servers). +// So that even if the main function panics we can produce required logs for troubleshooting +var exitErr error - cfg, err := configs.New() +func recoverer() { + ctx := context.Background() + exitCode := 0 + var exitInfo any + rec := recover() + err, _ := rec.(error) if err != nil { - _ = logger.Fatal(fmt.Sprintf("%+v", err)) - return + exitCode = 1 + exitInfo = err + } else if rec != nil { + exitCode = 2 + exitInfo = rec + } else if exitErr != nil { + exitCode = 3 + exitInfo = exitErr } - dscfg, err := cfg.Datastore() - if err != nil { - _ = logger.Fatal(fmt.Sprintf("%+v", err)) - return + // exiting after receiving a quit signal can be considered a *clean/successful* exit + if errors.Is(exitErr, sysignals.ErrSigQuit) { + exitCode = 0 } - pqdriver, err := datastore.NewService(dscfg) - if err != nil { - _ = logger.Fatal(fmt.Sprintf("%+v", err)) - return + // logging this because we have info logs saying "listening to" various port numbers + // based on the server type (gRPC, HTTP etc.). But it's unclear *from the logs* + // if the server is up and running, if it exits for any reason + if exitCode == 0 { + logger.Info(ctx, fmt.Sprintf("shutdown complete: %+v", exitInfo)) + } else { + logger.Error(ctx, fmt.Sprintf("shutdown complete (exit: %d): %+v", exitCode, exitInfo)) } - cacheCfg, err := cfg.Cachestore() - if err != nil { - _ = logger.Fatal(fmt.Sprintf("%+v", err)) - return - } + os.Exit(exitCode) +} - redispool, err := cachestore.New(cacheCfg) - if err != nil { - // Cache could be something we'd be willing to tolerate if not available. - // Though this is strictly based on how critical cache is to your application - _ = logger.Error(fmt.Sprintf("%+v", err)) - } +func shutdown( + httpServer *http.HTTP, + grpcServer *grpc.GRPC, + apmIns *apm.APM, +) { + const shutdownTimeout = time.Second * 60 + ctx, cancel := context.WithTimeout(context.Background(), shutdownTimeout) + defer cancel() - userStore, err := users.NewStore(pqdriver) - if err != nil { - _ = logger.Fatal(fmt.Sprintf("%+v", err)) - return - } + logger.Info(ctx, "initiating shutdown") - userCache, err := users.NewCacheStore(redispool) - if err != nil { - _ = logger.Fatal(fmt.Sprintf("%+v", err)) - return - } + wgroup := &sync.WaitGroup{} + wgroup.Add(1) - us, err := users.NewService(l, userStore, userCache) - if err != nil { - _ = logger.Fatal(fmt.Sprintf("%+v", err)) - return - } + wgroup.Wait() + + // after all the APIs of the application are shutdown (e.g. HTTP, gRPC, Pubsub listener etc.) + // we should close connections to dependencies like database, cache etc. + // This should only be done after the APIs are shutdown completely + wgroup.Add(1) + go func() { + defer wgroup.Done() + }() + + wgroup.Wait() +} + +func main() { + defer recoverer() + ctx := context.Background() + _ = ctx + fatalErr := make(chan error, 1) - a, err := api.NewService(us) + cfgs, err := configs.New() if err != nil { - _ = logger.Fatal(fmt.Sprintf("%+v", err)) - return + panic(err) } - httpCfg, err := cfg.HTTP() + svrAPIs := api.NewServer(nil) + hcfg, _ := cfgs.HTTP() + hserver, err := http.NewService(hcfg, svrAPIs) if err != nil { - _ = logger.Fatal(fmt.Sprintf("%+v", err)) - return + panic(err) } + _ = hserver.Start() - h, err := http.NewService( - httpCfg, - a, + defer shutdown( + hserver, + nil, + nil, ) - if err != nil { - _ = logger.Fatal(fmt.Sprintf("%+v", err)) - return - } - _ = logger.Fatal(h.Start()) + exitErr = <-fatalErr } diff --git a/makeitmine.sh b/makeitmine.sh deleted file mode 100755 index 095c7ae..0000000 --- a/makeitmine.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash -# http://redsymbol.net/articles/unofficial-bash-strict-mode/ -set -euo pipefail -IFS=$'\n\t' - -cwd=${PWD} -basepath=$(dirname -- ${BASH_SOURCE[0]}) - -thisfile=`basename "$0"` -fontcolorgreen=$(tput setaf 2) -fontbold=$(tput bold) -fontnormal=$(tput sgr0) - -existingmodulename="github.com/bnkamalesh/goapp" -modulename='' -a_flag=false - -print_usage() { - printf """ -Usage: -./makeitmine.sh -n -a -e example.org/me/myapp - -Options -======= --n Parameter accepts the new module name, and is mandatory --a Optional flag if set, will do the following: - - remove .git directory - - empty README.md - - remove .travis.yml --e Optional parameter accepts an existing module name to be replaced. Default is 'github.com/bnkamalesh/pusaki' - - """ -} - -# https://stackoverflow.com/a/7069755 -while getopts 'an:e:' flag; do - case "${flag}" in - a) a_flag=true;; - n) modulename="${OPTARG}" ;; - e) existingmodulename="${OPTARG}" ;; - *) print_usage - echo "exiting?" - exit 1 ;; - esac -done - -if [ -z "$modulename" ] -then - print_usage - exit 2; -fi - -if [ -z "$existingmodulename" ] -then - print_usage - exit 3; -fi - -totalsteps="2" -if [ $a_flag = true ] -then - totalsteps="3" -fi - -currentStep=1 - -printf "${fontbold}[$currentStep/$totalsteps] Setting up your module '$modulename'${fontnormal}\n" -# Replacing . with \. to escape . while being used in regex -unescapedmodule=$modulename -modulename=${modulename//./\\.} -unescapedexistingmodule=$existingmodulename -existingmodulename=${existingmodulename//./\\.} - -# using ; as separator in sed, because `/` is prevalent in most Go module paths -replacer="s;$existingmodulename;$modulename;g" -echo " - Replacing module '$unescapedexistingmodule' with '$unescapedmodule'" -grep -rl $existingmodulename ${basepath}/ --exclude-dir=.git --exclude-dir=vendor --exclude=README.md --exclude=$thisfile | xargs sed -i $replacer -printf "${fontcolorgreen}${fontbold}= Done${fontnormal}\n" - -if [ $a_flag = true ] -then - ((currentStep++)) - printf "\n${fontbold}7 Deleting .git and emptying README${fontnormal}\n" - rm -rf ${basepath}/.git ${basepath}/.travis.yml - echo "" > ${basepath}/README.md - printf "${fontcolorgreen}${fontbold}= Done${fontnormal}\n" -fi - -((currentStep++)) -printf "\n${fontbold}[$currentStep/$totalsteps] Go clean-up ${fontnormal}\n" -cd $basepath -go mod tidy -go mod verify -printf "${fontcolorgreen}${fontbold}= Done${fontnormal}\n" - -printf "\n${fontcolorgreen}${fontbold}=== Done [$currentStep/$totalsteps]${fontnormal}\n\n" -exit 0; diff --git a/vendor/github.com/Masterminds/squirrel/.gitignore b/vendor/github.com/Masterminds/squirrel/.gitignore deleted file mode 100644 index 4a0699f..0000000 --- a/vendor/github.com/Masterminds/squirrel/.gitignore +++ /dev/null @@ -1 +0,0 @@ -squirrel.test \ No newline at end of file diff --git a/vendor/github.com/Masterminds/squirrel/.travis.yml b/vendor/github.com/Masterminds/squirrel/.travis.yml deleted file mode 100644 index 7bb6da4..0000000 --- a/vendor/github.com/Masterminds/squirrel/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: go - -go: - - 1.11.x - - 1.12.x - - 1.13.x - -services: - - mysql - - postgresql - -# Setting sudo access to false will let Travis CI use containers rather than -# VMs to run the tests. For more details see: -# - http://docs.travis-ci.com/user/workers/container-based-infrastructure/ -# - http://docs.travis-ci.com/user/workers/standard-infrastructure/ -sudo: false - -before_script: - - mysql -e 'CREATE DATABASE squirrel;' - - psql -c 'CREATE DATABASE squirrel;' -U postgres - -script: - - go test - - cd integration - - go test -args -driver sqlite3 - - go test -args -driver mysql -dataSource travis@/squirrel - - go test -args -driver postgres -dataSource 'postgres://postgres@localhost/squirrel?sslmode=disable' - -notifications: - irc: "irc.freenode.net#masterminds" diff --git a/vendor/github.com/Masterminds/squirrel/LICENSE.txt b/vendor/github.com/Masterminds/squirrel/LICENSE.txt deleted file mode 100644 index 74c20a2..0000000 --- a/vendor/github.com/Masterminds/squirrel/LICENSE.txt +++ /dev/null @@ -1,23 +0,0 @@ -Squirrel -The Masterminds -Copyright (C) 2014-2015, Lann Martin -Copyright (C) 2015-2016, Google -Copyright (C) 2015, Matt Farina and Matt Butcher - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/Masterminds/squirrel/README.md b/vendor/github.com/Masterminds/squirrel/README.md deleted file mode 100644 index 1d37f28..0000000 --- a/vendor/github.com/Masterminds/squirrel/README.md +++ /dev/null @@ -1,142 +0,0 @@ -[![Stability: Maintenance](https://masterminds.github.io/stability/maintenance.svg)](https://masterminds.github.io/stability/maintenance.html) -### Squirrel is "complete". -Bug fixes will still be merged (slowly). Bug reports are welcome, but I will not necessarily respond to them. If another fork (or substantially similar project) actively improves on what Squirrel does, let me know and I may link to it here. - - -# Squirrel - fluent SQL generator for Go - -```go -import "github.com/Masterminds/squirrel" -``` - - -[![GoDoc](https://godoc.org/github.com/Masterminds/squirrel?status.png)](https://godoc.org/github.com/Masterminds/squirrel) -[![Build Status](https://api.travis-ci.org/Masterminds/squirrel.svg?branch=master)](https://travis-ci.org/Masterminds/squirrel) - -**Squirrel is not an ORM.** For an application of Squirrel, check out -[structable, a table-struct mapper](https://github.com/Masterminds/structable) - - -Squirrel helps you build SQL queries from composable parts: - -```go -import sq "github.com/Masterminds/squirrel" - -users := sq.Select("*").From("users").Join("emails USING (email_id)") - -active := users.Where(sq.Eq{"deleted_at": nil}) - -sql, args, err := active.ToSql() - -sql == "SELECT * FROM users JOIN emails USING (email_id) WHERE deleted_at IS NULL" -``` - -```go -sql, args, err := sq. - Insert("users").Columns("name", "age"). - Values("moe", 13).Values("larry", sq.Expr("? + 5", 12)). - ToSql() - -sql == "INSERT INTO users (name,age) VALUES (?,?),(?,? + 5)" -``` - -Squirrel can also execute queries directly: - -```go -stooges := users.Where(sq.Eq{"username": []string{"moe", "larry", "curly", "shemp"}}) -three_stooges := stooges.Limit(3) -rows, err := three_stooges.RunWith(db).Query() - -// Behaves like: -rows, err := db.Query("SELECT * FROM users WHERE username IN (?,?,?,?) LIMIT 3", - "moe", "larry", "curly", "shemp") -``` - -Squirrel makes conditional query building a breeze: - -```go -if len(q) > 0 { - users = users.Where("name LIKE ?", fmt.Sprint("%", q, "%")) -} -``` - -Squirrel wants to make your life easier: - -```go -// StmtCache caches Prepared Stmts for you -dbCache := sq.NewStmtCache(db) - -// StatementBuilder keeps your syntax neat -mydb := sq.StatementBuilder.RunWith(dbCache) -select_users := mydb.Select("*").From("users") -``` - -Squirrel loves PostgreSQL: - -```go -psql := sq.StatementBuilder.PlaceholderFormat(sq.Dollar) - -// You use question marks for placeholders... -sql, _, _ := psql.Select("*").From("elephants").Where("name IN (?,?)", "Dumbo", "Verna").ToSql() - -/// ...squirrel replaces them using PlaceholderFormat. -sql == "SELECT * FROM elephants WHERE name IN ($1,$2)" - - -/// You can retrieve id ... -query := sq.Insert("nodes"). - Columns("uuid", "type", "data"). - Values(node.Uuid, node.Type, node.Data). - Suffix("RETURNING \"id\""). - RunWith(m.db). - PlaceholderFormat(sq.Dollar) - -query.QueryRow().Scan(&node.id) -``` - -You can escape question marks by inserting two question marks: - -```sql -SELECT * FROM nodes WHERE meta->'format' ??| array[?,?] -``` - -will generate with the Dollar Placeholder: - -```sql -SELECT * FROM nodes WHERE meta->'format' ?| array[$1,$2] -``` - -## FAQ - -* **How can I build an IN query on composite keys / tuples, e.g. `WHERE (col1, col2) IN ((1,2),(3,4))`? ([#104](https://github.com/Masterminds/squirrel/issues/104))** - - Squirrel does not explicitly support tuples, but you can get the same effect with e.g.: - - ```go - sq.Or{ - sq.Eq{"col1": 1, "col2": 2}, - sq.Eq{"col1": 3, "col2": 4}} - ``` - - ```sql - WHERE (col1 = 1 AND col2 = 2) OR (col1 = 3 AND col2 = 4) - ``` - - (which should produce the same query plan as the tuple version) - -* **Why doesn't `Eq{"mynumber": []uint8{1,2,3}}` turn into an `IN` query? ([#114](https://github.com/Masterminds/squirrel/issues/114))** - - Values of type `[]byte` are handled specially by `database/sql`. In Go, [`byte` is just an alias of `uint8`](https://golang.org/pkg/builtin/#byte), so there is no way to distinguish `[]uint8` from `[]byte`. - -* **Some features are poorly documented!** - - This isn't a frequent complaints section! - -* **Some features are poorly documented?** - - Yes. The tests should be considered a part of the documentation; take a look at those for ideas on how to express more complex queries. - -## License - -Squirrel is released under the -[MIT License](http://www.opensource.org/licenses/MIT). diff --git a/vendor/github.com/Masterminds/squirrel/case.go b/vendor/github.com/Masterminds/squirrel/case.go deleted file mode 100644 index 299e14b..0000000 --- a/vendor/github.com/Masterminds/squirrel/case.go +++ /dev/null @@ -1,128 +0,0 @@ -package squirrel - -import ( - "bytes" - "errors" - - "github.com/lann/builder" -) - -func init() { - builder.Register(CaseBuilder{}, caseData{}) -} - -// sqlizerBuffer is a helper that allows to write many Sqlizers one by one -// without constant checks for errors that may come from Sqlizer -type sqlizerBuffer struct { - bytes.Buffer - args []interface{} - err error -} - -// WriteSql converts Sqlizer to SQL strings and writes it to buffer -func (b *sqlizerBuffer) WriteSql(item Sqlizer) { - if b.err != nil { - return - } - - var str string - var args []interface{} - str, args, b.err = nestedToSql(item) - - if b.err != nil { - return - } - - b.WriteString(str) - b.WriteByte(' ') - b.args = append(b.args, args...) -} - -func (b *sqlizerBuffer) ToSql() (string, []interface{}, error) { - return b.String(), b.args, b.err -} - -// whenPart is a helper structure to describe SQLs "WHEN ... THEN ..." expression -type whenPart struct { - when Sqlizer - then Sqlizer -} - -func newWhenPart(when interface{}, then interface{}) whenPart { - return whenPart{newPart(when), newPart(then)} -} - -// caseData holds all the data required to build a CASE SQL construct -type caseData struct { - What Sqlizer - WhenParts []whenPart - Else Sqlizer -} - -// ToSql implements Sqlizer -func (d *caseData) ToSql() (sqlStr string, args []interface{}, err error) { - if len(d.WhenParts) == 0 { - err = errors.New("case expression must contain at lease one WHEN clause") - - return - } - - sql := sqlizerBuffer{} - - sql.WriteString("CASE ") - if d.What != nil { - sql.WriteSql(d.What) - } - - for _, p := range d.WhenParts { - sql.WriteString("WHEN ") - sql.WriteSql(p.when) - sql.WriteString("THEN ") - sql.WriteSql(p.then) - } - - if d.Else != nil { - sql.WriteString("ELSE ") - sql.WriteSql(d.Else) - } - - sql.WriteString("END") - - return sql.ToSql() -} - -// CaseBuilder builds SQL CASE construct which could be used as parts of queries. -type CaseBuilder builder.Builder - -// ToSql builds the query into a SQL string and bound args. -func (b CaseBuilder) ToSql() (string, []interface{}, error) { - data := builder.GetStruct(b).(caseData) - return data.ToSql() -} - -// MustSql builds the query into a SQL string and bound args. -// It panics if there are any errors. -func (b CaseBuilder) MustSql() (string, []interface{}) { - sql, args, err := b.ToSql() - if err != nil { - panic(err) - } - return sql, args -} - -// what sets optional value for CASE construct "CASE [value] ..." -func (b CaseBuilder) what(expr interface{}) CaseBuilder { - return builder.Set(b, "What", newPart(expr)).(CaseBuilder) -} - -// When adds "WHEN ... THEN ..." part to CASE construct -func (b CaseBuilder) When(when interface{}, then interface{}) CaseBuilder { - // TODO: performance hint: replace slice of WhenPart with just slice of parts - // where even indices of the slice belong to "when"s and odd indices belong to "then"s - return builder.Append(b, "WhenParts", newWhenPart(when, then)).(CaseBuilder) -} - -// What sets optional "ELSE ..." part for CASE construct -func (b CaseBuilder) Else(expr interface{}) CaseBuilder { - return builder.Set(b, "Else", newPart(expr)).(CaseBuilder) -} diff --git a/vendor/github.com/Masterminds/squirrel/delete.go b/vendor/github.com/Masterminds/squirrel/delete.go deleted file mode 100644 index f3f31e6..0000000 --- a/vendor/github.com/Masterminds/squirrel/delete.go +++ /dev/null @@ -1,191 +0,0 @@ -package squirrel - -import ( - "bytes" - "database/sql" - "fmt" - "strings" - - "github.com/lann/builder" -) - -type deleteData struct { - PlaceholderFormat PlaceholderFormat - RunWith BaseRunner - Prefixes []Sqlizer - From string - WhereParts []Sqlizer - OrderBys []string - Limit string - Offset string - Suffixes []Sqlizer -} - -func (d *deleteData) Exec() (sql.Result, error) { - if d.RunWith == nil { - return nil, RunnerNotSet - } - return ExecWith(d.RunWith, d) -} - -func (d *deleteData) ToSql() (sqlStr string, args []interface{}, err error) { - if len(d.From) == 0 { - err = fmt.Errorf("delete statements must specify a From table") - return - } - - sql := &bytes.Buffer{} - - if len(d.Prefixes) > 0 { - args, err = appendToSql(d.Prefixes, sql, " ", args) - if err != nil { - return - } - - sql.WriteString(" ") - } - - sql.WriteString("DELETE FROM ") - sql.WriteString(d.From) - - if len(d.WhereParts) > 0 { - sql.WriteString(" WHERE ") - args, err = appendToSql(d.WhereParts, sql, " AND ", args) - if err != nil { - return - } - } - - if len(d.OrderBys) > 0 { - sql.WriteString(" ORDER BY ") - sql.WriteString(strings.Join(d.OrderBys, ", ")) - } - - if len(d.Limit) > 0 { - sql.WriteString(" LIMIT ") - sql.WriteString(d.Limit) - } - - if len(d.Offset) > 0 { - sql.WriteString(" OFFSET ") - sql.WriteString(d.Offset) - } - - if len(d.Suffixes) > 0 { - sql.WriteString(" ") - args, err = appendToSql(d.Suffixes, sql, " ", args) - if err != nil { - return - } - } - - sqlStr, err = d.PlaceholderFormat.ReplacePlaceholders(sql.String()) - return -} - -// Builder - -// DeleteBuilder builds SQL DELETE statements. -type DeleteBuilder builder.Builder - -func init() { - builder.Register(DeleteBuilder{}, deleteData{}) -} - -// Format methods - -// PlaceholderFormat sets PlaceholderFormat (e.g. Question or Dollar) for the -// query. -func (b DeleteBuilder) PlaceholderFormat(f PlaceholderFormat) DeleteBuilder { - return builder.Set(b, "PlaceholderFormat", f).(DeleteBuilder) -} - -// Runner methods - -// RunWith sets a Runner (like database/sql.DB) to be used with e.g. Exec. -func (b DeleteBuilder) RunWith(runner BaseRunner) DeleteBuilder { - return setRunWith(b, runner).(DeleteBuilder) -} - -// Exec builds and Execs the query with the Runner set by RunWith. -func (b DeleteBuilder) Exec() (sql.Result, error) { - data := builder.GetStruct(b).(deleteData) - return data.Exec() -} - -// SQL methods - -// ToSql builds the query into a SQL string and bound args. -func (b DeleteBuilder) ToSql() (string, []interface{}, error) { - data := builder.GetStruct(b).(deleteData) - return data.ToSql() -} - -// MustSql builds the query into a SQL string and bound args. -// It panics if there are any errors. -func (b DeleteBuilder) MustSql() (string, []interface{}) { - sql, args, err := b.ToSql() - if err != nil { - panic(err) - } - return sql, args -} - -// Prefix adds an expression to the beginning of the query -func (b DeleteBuilder) Prefix(sql string, args ...interface{}) DeleteBuilder { - return b.PrefixExpr(Expr(sql, args...)) -} - -// PrefixExpr adds an expression to the very beginning of the query -func (b DeleteBuilder) PrefixExpr(expr Sqlizer) DeleteBuilder { - return builder.Append(b, "Prefixes", expr).(DeleteBuilder) -} - -// From sets the table to be deleted from. -func (b DeleteBuilder) From(from string) DeleteBuilder { - return builder.Set(b, "From", from).(DeleteBuilder) -} - -// Where adds WHERE expressions to the query. -// -// See SelectBuilder.Where for more information. -func (b DeleteBuilder) Where(pred interface{}, args ...interface{}) DeleteBuilder { - return builder.Append(b, "WhereParts", newWherePart(pred, args...)).(DeleteBuilder) -} - -// OrderBy adds ORDER BY expressions to the query. -func (b DeleteBuilder) OrderBy(orderBys ...string) DeleteBuilder { - return builder.Extend(b, "OrderBys", orderBys).(DeleteBuilder) -} - -// Limit sets a LIMIT clause on the query. -func (b DeleteBuilder) Limit(limit uint64) DeleteBuilder { - return builder.Set(b, "Limit", fmt.Sprintf("%d", limit)).(DeleteBuilder) -} - -// Offset sets a OFFSET clause on the query. -func (b DeleteBuilder) Offset(offset uint64) DeleteBuilder { - return builder.Set(b, "Offset", fmt.Sprintf("%d", offset)).(DeleteBuilder) -} - -// Suffix adds an expression to the end of the query -func (b DeleteBuilder) Suffix(sql string, args ...interface{}) DeleteBuilder { - return b.SuffixExpr(Expr(sql, args...)) -} - -// SuffixExpr adds an expression to the end of the query -func (b DeleteBuilder) SuffixExpr(expr Sqlizer) DeleteBuilder { - return builder.Append(b, "Suffixes", expr).(DeleteBuilder) -} - -func (b DeleteBuilder) Query() (*sql.Rows, error) { - data := builder.GetStruct(b).(deleteData) - return data.Query() -} - -func (d *deleteData) Query() (*sql.Rows, error) { - if d.RunWith == nil { - return nil, RunnerNotSet - } - return QueryWith(d.RunWith, d) -} diff --git a/vendor/github.com/Masterminds/squirrel/delete_ctx.go b/vendor/github.com/Masterminds/squirrel/delete_ctx.go deleted file mode 100644 index de83c55..0000000 --- a/vendor/github.com/Masterminds/squirrel/delete_ctx.go +++ /dev/null @@ -1,69 +0,0 @@ -// +build go1.8 - -package squirrel - -import ( - "context" - "database/sql" - - "github.com/lann/builder" -) - -func (d *deleteData) ExecContext(ctx context.Context) (sql.Result, error) { - if d.RunWith == nil { - return nil, RunnerNotSet - } - ctxRunner, ok := d.RunWith.(ExecerContext) - if !ok { - return nil, NoContextSupport - } - return ExecContextWith(ctx, ctxRunner, d) -} - -func (d *deleteData) QueryContext(ctx context.Context) (*sql.Rows, error) { - if d.RunWith == nil { - return nil, RunnerNotSet - } - ctxRunner, ok := d.RunWith.(QueryerContext) - if !ok { - return nil, NoContextSupport - } - return QueryContextWith(ctx, ctxRunner, d) -} - -func (d *deleteData) QueryRowContext(ctx context.Context) RowScanner { - if d.RunWith == nil { - return &Row{err: RunnerNotSet} - } - queryRower, ok := d.RunWith.(QueryRowerContext) - if !ok { - if _, ok := d.RunWith.(QueryerContext); !ok { - return &Row{err: RunnerNotQueryRunner} - } - return &Row{err: NoContextSupport} - } - return QueryRowContextWith(ctx, queryRower, d) -} - -// ExecContext builds and ExecContexts the query with the Runner set by RunWith. -func (b DeleteBuilder) ExecContext(ctx context.Context) (sql.Result, error) { - data := builder.GetStruct(b).(deleteData) - return data.ExecContext(ctx) -} - -// QueryContext builds and QueryContexts the query with the Runner set by RunWith. -func (b DeleteBuilder) QueryContext(ctx context.Context) (*sql.Rows, error) { - data := builder.GetStruct(b).(deleteData) - return data.QueryContext(ctx) -} - -// QueryRowContext builds and QueryRowContexts the query with the Runner set by RunWith. -func (b DeleteBuilder) QueryRowContext(ctx context.Context) RowScanner { - data := builder.GetStruct(b).(deleteData) - return data.QueryRowContext(ctx) -} - -// ScanContext is a shortcut for QueryRowContext().Scan. -func (b DeleteBuilder) ScanContext(ctx context.Context, dest ...interface{}) error { - return b.QueryRowContext(ctx).Scan(dest...) -} diff --git a/vendor/github.com/Masterminds/squirrel/expr.go b/vendor/github.com/Masterminds/squirrel/expr.go deleted file mode 100644 index eba1b45..0000000 --- a/vendor/github.com/Masterminds/squirrel/expr.go +++ /dev/null @@ -1,419 +0,0 @@ -package squirrel - -import ( - "bytes" - "database/sql/driver" - "fmt" - "reflect" - "sort" - "strings" -) - -const ( - // Portable true/false literals. - sqlTrue = "(1=1)" - sqlFalse = "(1=0)" -) - -type expr struct { - sql string - args []interface{} -} - -// Expr builds an expression from a SQL fragment and arguments. -// -// Ex: -// Expr("FROM_UNIXTIME(?)", t) -func Expr(sql string, args ...interface{}) Sqlizer { - return expr{sql: sql, args: args} -} - -func (e expr) ToSql() (sql string, args []interface{}, err error) { - simple := true - for _, arg := range e.args { - if _, ok := arg.(Sqlizer); ok { - simple = false - } - } - if simple { - return e.sql, e.args, nil - } - - buf := &bytes.Buffer{} - ap := e.args - sp := e.sql - - var isql string - var iargs []interface{} - - for err == nil && len(ap) > 0 && len(sp) > 0 { - i := strings.Index(sp, "?") - if i < 0 { - // no more placeholders - break - } - if len(sp) > i+1 && sp[i+1:i+2] == "?" { - // escaped "??"; append it and step past - buf.WriteString(sp[:i+2]) - sp = sp[i+2:] - continue - } - - if as, ok := ap[0].(Sqlizer); ok { - // sqlizer argument; expand it and append the result - isql, iargs, err = as.ToSql() - buf.WriteString(sp[:i]) - buf.WriteString(isql) - args = append(args, iargs...) - } else { - // normal argument; append it and the placeholder - buf.WriteString(sp[:i+1]) - args = append(args, ap[0]) - } - - // step past the argument and placeholder - ap = ap[1:] - sp = sp[i+1:] - } - - // append the remaining sql and arguments - buf.WriteString(sp) - return buf.String(), append(args, ap...), err -} - -type concatExpr []interface{} - -func (ce concatExpr) ToSql() (sql string, args []interface{}, err error) { - for _, part := range ce { - switch p := part.(type) { - case string: - sql += p - case Sqlizer: - pSql, pArgs, err := p.ToSql() - if err != nil { - return "", nil, err - } - sql += pSql - args = append(args, pArgs...) - default: - return "", nil, fmt.Errorf("%#v is not a string or Sqlizer", part) - } - } - return -} - -// ConcatExpr builds an expression by concatenating strings and other expressions. -// -// Ex: -// name_expr := Expr("CONCAT(?, ' ', ?)", firstName, lastName) -// ConcatExpr("COALESCE(full_name,", name_expr, ")") -func ConcatExpr(parts ...interface{}) concatExpr { - return concatExpr(parts) -} - -// aliasExpr helps to alias part of SQL query generated with underlying "expr" -type aliasExpr struct { - expr Sqlizer - alias string -} - -// Alias allows to define alias for column in SelectBuilder. Useful when column is -// defined as complex expression like IF or CASE -// Ex: -// .Column(Alias(caseStmt, "case_column")) -func Alias(expr Sqlizer, alias string) aliasExpr { - return aliasExpr{expr, alias} -} - -func (e aliasExpr) ToSql() (sql string, args []interface{}, err error) { - sql, args, err = e.expr.ToSql() - if err == nil { - sql = fmt.Sprintf("(%s) AS %s", sql, e.alias) - } - return -} - -// Eq is syntactic sugar for use with Where/Having/Set methods. -type Eq map[string]interface{} - -func (eq Eq) toSQL(useNotOpr bool) (sql string, args []interface{}, err error) { - if len(eq) == 0 { - // Empty Sql{} evaluates to true. - sql = sqlTrue - return - } - - var ( - exprs []string - equalOpr = "=" - inOpr = "IN" - nullOpr = "IS" - inEmptyExpr = sqlFalse - ) - - if useNotOpr { - equalOpr = "<>" - inOpr = "NOT IN" - nullOpr = "IS NOT" - inEmptyExpr = sqlTrue - } - - sortedKeys := getSortedKeys(eq) - for _, key := range sortedKeys { - var expr string - val := eq[key] - - switch v := val.(type) { - case driver.Valuer: - if val, err = v.Value(); err != nil { - return - } - } - - r := reflect.ValueOf(val) - if r.Kind() == reflect.Ptr { - if r.IsNil() { - val = nil - } else { - val = r.Elem().Interface() - } - } - - if val == nil { - expr = fmt.Sprintf("%s %s NULL", key, nullOpr) - } else { - if isListType(val) { - valVal := reflect.ValueOf(val) - if valVal.Len() == 0 { - expr = inEmptyExpr - if args == nil { - args = []interface{}{} - } - } else { - for i := 0; i < valVal.Len(); i++ { - args = append(args, valVal.Index(i).Interface()) - } - expr = fmt.Sprintf("%s %s (%s)", key, inOpr, Placeholders(valVal.Len())) - } - } else { - expr = fmt.Sprintf("%s %s ?", key, equalOpr) - args = append(args, val) - } - } - exprs = append(exprs, expr) - } - sql = strings.Join(exprs, " AND ") - return -} - -func (eq Eq) ToSql() (sql string, args []interface{}, err error) { - return eq.toSQL(false) -} - -// NotEq is syntactic sugar for use with Where/Having/Set methods. -// Ex: -// .Where(NotEq{"id": 1}) == "id <> 1" -type NotEq Eq - -func (neq NotEq) ToSql() (sql string, args []interface{}, err error) { - return Eq(neq).toSQL(true) -} - -// Like is syntactic sugar for use with LIKE conditions. -// Ex: -// .Where(Like{"name": "%irrel"}) -type Like map[string]interface{} - -func (lk Like) toSql(opr string) (sql string, args []interface{}, err error) { - var exprs []string - for key, val := range lk { - expr := "" - - switch v := val.(type) { - case driver.Valuer: - if val, err = v.Value(); err != nil { - return - } - } - - if val == nil { - err = fmt.Errorf("cannot use null with like operators") - return - } else { - if isListType(val) { - err = fmt.Errorf("cannot use array or slice with like operators") - return - } else { - expr = fmt.Sprintf("%s %s ?", key, opr) - args = append(args, val) - } - } - exprs = append(exprs, expr) - } - sql = strings.Join(exprs, " AND ") - return -} - -func (lk Like) ToSql() (sql string, args []interface{}, err error) { - return lk.toSql("LIKE") -} - -// NotLike is syntactic sugar for use with LIKE conditions. -// Ex: -// .Where(NotLike{"name": "%irrel"}) -type NotLike Like - -func (nlk NotLike) ToSql() (sql string, args []interface{}, err error) { - return Like(nlk).toSql("NOT LIKE") -} - -// ILike is syntactic sugar for use with ILIKE conditions. -// Ex: -// .Where(ILike{"name": "sq%"}) -type ILike Like - -func (ilk ILike) ToSql() (sql string, args []interface{}, err error) { - return Like(ilk).toSql("ILIKE") -} - -// NotILike is syntactic sugar for use with ILIKE conditions. -// Ex: -// .Where(NotILike{"name": "sq%"}) -type NotILike Like - -func (nilk NotILike) ToSql() (sql string, args []interface{}, err error) { - return Like(nilk).toSql("NOT ILIKE") -} - -// Lt is syntactic sugar for use with Where/Having/Set methods. -// Ex: -// .Where(Lt{"id": 1}) -type Lt map[string]interface{} - -func (lt Lt) toSql(opposite, orEq bool) (sql string, args []interface{}, err error) { - var ( - exprs []string - opr = "<" - ) - - if opposite { - opr = ">" - } - - if orEq { - opr = fmt.Sprintf("%s%s", opr, "=") - } - - sortedKeys := getSortedKeys(lt) - for _, key := range sortedKeys { - var expr string - val := lt[key] - - switch v := val.(type) { - case driver.Valuer: - if val, err = v.Value(); err != nil { - return - } - } - - if val == nil { - err = fmt.Errorf("cannot use null with less than or greater than operators") - return - } - if isListType(val) { - err = fmt.Errorf("cannot use array or slice with less than or greater than operators") - return - } - expr = fmt.Sprintf("%s %s ?", key, opr) - args = append(args, val) - - exprs = append(exprs, expr) - } - sql = strings.Join(exprs, " AND ") - return -} - -func (lt Lt) ToSql() (sql string, args []interface{}, err error) { - return lt.toSql(false, false) -} - -// LtOrEq is syntactic sugar for use with Where/Having/Set methods. -// Ex: -// .Where(LtOrEq{"id": 1}) == "id <= 1" -type LtOrEq Lt - -func (ltOrEq LtOrEq) ToSql() (sql string, args []interface{}, err error) { - return Lt(ltOrEq).toSql(false, true) -} - -// Gt is syntactic sugar for use with Where/Having/Set methods. -// Ex: -// .Where(Gt{"id": 1}) == "id > 1" -type Gt Lt - -func (gt Gt) ToSql() (sql string, args []interface{}, err error) { - return Lt(gt).toSql(true, false) -} - -// GtOrEq is syntactic sugar for use with Where/Having/Set methods. -// Ex: -// .Where(GtOrEq{"id": 1}) == "id >= 1" -type GtOrEq Lt - -func (gtOrEq GtOrEq) ToSql() (sql string, args []interface{}, err error) { - return Lt(gtOrEq).toSql(true, true) -} - -type conj []Sqlizer - -func (c conj) join(sep, defaultExpr string) (sql string, args []interface{}, err error) { - if len(c) == 0 { - return defaultExpr, []interface{}{}, nil - } - var sqlParts []string - for _, sqlizer := range c { - partSQL, partArgs, err := nestedToSql(sqlizer) - if err != nil { - return "", nil, err - } - if partSQL != "" { - sqlParts = append(sqlParts, partSQL) - args = append(args, partArgs...) - } - } - if len(sqlParts) > 0 { - sql = fmt.Sprintf("(%s)", strings.Join(sqlParts, sep)) - } - return -} - -// And conjunction Sqlizers -type And conj - -func (a And) ToSql() (string, []interface{}, error) { - return conj(a).join(" AND ", sqlTrue) -} - -// Or conjunction Sqlizers -type Or conj - -func (o Or) ToSql() (string, []interface{}, error) { - return conj(o).join(" OR ", sqlFalse) -} - -func getSortedKeys(exp map[string]interface{}) []string { - sortedKeys := make([]string, 0, len(exp)) - for k := range exp { - sortedKeys = append(sortedKeys, k) - } - sort.Strings(sortedKeys) - return sortedKeys -} - -func isListType(val interface{}) bool { - if driver.IsValue(val) { - return false - } - valVal := reflect.ValueOf(val) - return valVal.Kind() == reflect.Array || valVal.Kind() == reflect.Slice -} diff --git a/vendor/github.com/Masterminds/squirrel/insert.go b/vendor/github.com/Masterminds/squirrel/insert.go deleted file mode 100644 index c23a579..0000000 --- a/vendor/github.com/Masterminds/squirrel/insert.go +++ /dev/null @@ -1,298 +0,0 @@ -package squirrel - -import ( - "bytes" - "database/sql" - "errors" - "fmt" - "io" - "sort" - "strings" - - "github.com/lann/builder" -) - -type insertData struct { - PlaceholderFormat PlaceholderFormat - RunWith BaseRunner - Prefixes []Sqlizer - StatementKeyword string - Options []string - Into string - Columns []string - Values [][]interface{} - Suffixes []Sqlizer - Select *SelectBuilder -} - -func (d *insertData) Exec() (sql.Result, error) { - if d.RunWith == nil { - return nil, RunnerNotSet - } - return ExecWith(d.RunWith, d) -} - -func (d *insertData) Query() (*sql.Rows, error) { - if d.RunWith == nil { - return nil, RunnerNotSet - } - return QueryWith(d.RunWith, d) -} - -func (d *insertData) QueryRow() RowScanner { - if d.RunWith == nil { - return &Row{err: RunnerNotSet} - } - queryRower, ok := d.RunWith.(QueryRower) - if !ok { - return &Row{err: RunnerNotQueryRunner} - } - return QueryRowWith(queryRower, d) -} - -func (d *insertData) ToSql() (sqlStr string, args []interface{}, err error) { - if len(d.Into) == 0 { - err = errors.New("insert statements must specify a table") - return - } - if len(d.Values) == 0 && d.Select == nil { - err = errors.New("insert statements must have at least one set of values or select clause") - return - } - - sql := &bytes.Buffer{} - - if len(d.Prefixes) > 0 { - args, err = appendToSql(d.Prefixes, sql, " ", args) - if err != nil { - return - } - - sql.WriteString(" ") - } - - if d.StatementKeyword == "" { - sql.WriteString("INSERT ") - } else { - sql.WriteString(d.StatementKeyword) - sql.WriteString(" ") - } - - if len(d.Options) > 0 { - sql.WriteString(strings.Join(d.Options, " ")) - sql.WriteString(" ") - } - - sql.WriteString("INTO ") - sql.WriteString(d.Into) - sql.WriteString(" ") - - if len(d.Columns) > 0 { - sql.WriteString("(") - sql.WriteString(strings.Join(d.Columns, ",")) - sql.WriteString(") ") - } - - if d.Select != nil { - args, err = d.appendSelectToSQL(sql, args) - } else { - args, err = d.appendValuesToSQL(sql, args) - } - if err != nil { - return - } - - if len(d.Suffixes) > 0 { - sql.WriteString(" ") - args, err = appendToSql(d.Suffixes, sql, " ", args) - if err != nil { - return - } - } - - sqlStr, err = d.PlaceholderFormat.ReplacePlaceholders(sql.String()) - return -} - -func (d *insertData) appendValuesToSQL(w io.Writer, args []interface{}) ([]interface{}, error) { - if len(d.Values) == 0 { - return args, errors.New("values for insert statements are not set") - } - - io.WriteString(w, "VALUES ") - - valuesStrings := make([]string, len(d.Values)) - for r, row := range d.Values { - valueStrings := make([]string, len(row)) - for v, val := range row { - if vs, ok := val.(Sqlizer); ok { - vsql, vargs, err := vs.ToSql() - if err != nil { - return nil, err - } - valueStrings[v] = vsql - args = append(args, vargs...) - } else { - valueStrings[v] = "?" - args = append(args, val) - } - } - valuesStrings[r] = fmt.Sprintf("(%s)", strings.Join(valueStrings, ",")) - } - - io.WriteString(w, strings.Join(valuesStrings, ",")) - - return args, nil -} - -func (d *insertData) appendSelectToSQL(w io.Writer, args []interface{}) ([]interface{}, error) { - if d.Select == nil { - return args, errors.New("select clause for insert statements are not set") - } - - selectClause, sArgs, err := d.Select.ToSql() - if err != nil { - return args, err - } - - io.WriteString(w, selectClause) - args = append(args, sArgs...) - - return args, nil -} - -// Builder - -// InsertBuilder builds SQL INSERT statements. -type InsertBuilder builder.Builder - -func init() { - builder.Register(InsertBuilder{}, insertData{}) -} - -// Format methods - -// PlaceholderFormat sets PlaceholderFormat (e.g. Question or Dollar) for the -// query. -func (b InsertBuilder) PlaceholderFormat(f PlaceholderFormat) InsertBuilder { - return builder.Set(b, "PlaceholderFormat", f).(InsertBuilder) -} - -// Runner methods - -// RunWith sets a Runner (like database/sql.DB) to be used with e.g. Exec. -func (b InsertBuilder) RunWith(runner BaseRunner) InsertBuilder { - return setRunWith(b, runner).(InsertBuilder) -} - -// Exec builds and Execs the query with the Runner set by RunWith. -func (b InsertBuilder) Exec() (sql.Result, error) { - data := builder.GetStruct(b).(insertData) - return data.Exec() -} - -// Query builds and Querys the query with the Runner set by RunWith. -func (b InsertBuilder) Query() (*sql.Rows, error) { - data := builder.GetStruct(b).(insertData) - return data.Query() -} - -// QueryRow builds and QueryRows the query with the Runner set by RunWith. -func (b InsertBuilder) QueryRow() RowScanner { - data := builder.GetStruct(b).(insertData) - return data.QueryRow() -} - -// Scan is a shortcut for QueryRow().Scan. -func (b InsertBuilder) Scan(dest ...interface{}) error { - return b.QueryRow().Scan(dest...) -} - -// SQL methods - -// ToSql builds the query into a SQL string and bound args. -func (b InsertBuilder) ToSql() (string, []interface{}, error) { - data := builder.GetStruct(b).(insertData) - return data.ToSql() -} - -// MustSql builds the query into a SQL string and bound args. -// It panics if there are any errors. -func (b InsertBuilder) MustSql() (string, []interface{}) { - sql, args, err := b.ToSql() - if err != nil { - panic(err) - } - return sql, args -} - -// Prefix adds an expression to the beginning of the query -func (b InsertBuilder) Prefix(sql string, args ...interface{}) InsertBuilder { - return b.PrefixExpr(Expr(sql, args...)) -} - -// PrefixExpr adds an expression to the very beginning of the query -func (b InsertBuilder) PrefixExpr(expr Sqlizer) InsertBuilder { - return builder.Append(b, "Prefixes", expr).(InsertBuilder) -} - -// Options adds keyword options before the INTO clause of the query. -func (b InsertBuilder) Options(options ...string) InsertBuilder { - return builder.Extend(b, "Options", options).(InsertBuilder) -} - -// Into sets the INTO clause of the query. -func (b InsertBuilder) Into(from string) InsertBuilder { - return builder.Set(b, "Into", from).(InsertBuilder) -} - -// Columns adds insert columns to the query. -func (b InsertBuilder) Columns(columns ...string) InsertBuilder { - return builder.Extend(b, "Columns", columns).(InsertBuilder) -} - -// Values adds a single row's values to the query. -func (b InsertBuilder) Values(values ...interface{}) InsertBuilder { - return builder.Append(b, "Values", values).(InsertBuilder) -} - -// Suffix adds an expression to the end of the query -func (b InsertBuilder) Suffix(sql string, args ...interface{}) InsertBuilder { - return b.SuffixExpr(Expr(sql, args...)) -} - -// SuffixExpr adds an expression to the end of the query -func (b InsertBuilder) SuffixExpr(expr Sqlizer) InsertBuilder { - return builder.Append(b, "Suffixes", expr).(InsertBuilder) -} - -// SetMap set columns and values for insert builder from a map of column name and value -// note that it will reset all previous columns and values was set if any -func (b InsertBuilder) SetMap(clauses map[string]interface{}) InsertBuilder { - // Keep the columns in a consistent order by sorting the column key string. - cols := make([]string, 0, len(clauses)) - for col := range clauses { - cols = append(cols, col) - } - sort.Strings(cols) - - vals := make([]interface{}, 0, len(clauses)) - for _, col := range cols { - vals = append(vals, clauses[col]) - } - - b = builder.Set(b, "Columns", cols).(InsertBuilder) - b = builder.Set(b, "Values", [][]interface{}{vals}).(InsertBuilder) - - return b -} - -// Select set Select clause for insert query -// If Values and Select are used, then Select has higher priority -func (b InsertBuilder) Select(sb SelectBuilder) InsertBuilder { - return builder.Set(b, "Select", &sb).(InsertBuilder) -} - -func (b InsertBuilder) statementKeyword(keyword string) InsertBuilder { - return builder.Set(b, "StatementKeyword", keyword).(InsertBuilder) -} diff --git a/vendor/github.com/Masterminds/squirrel/insert_ctx.go b/vendor/github.com/Masterminds/squirrel/insert_ctx.go deleted file mode 100644 index 4541c2f..0000000 --- a/vendor/github.com/Masterminds/squirrel/insert_ctx.go +++ /dev/null @@ -1,69 +0,0 @@ -// +build go1.8 - -package squirrel - -import ( - "context" - "database/sql" - - "github.com/lann/builder" -) - -func (d *insertData) ExecContext(ctx context.Context) (sql.Result, error) { - if d.RunWith == nil { - return nil, RunnerNotSet - } - ctxRunner, ok := d.RunWith.(ExecerContext) - if !ok { - return nil, NoContextSupport - } - return ExecContextWith(ctx, ctxRunner, d) -} - -func (d *insertData) QueryContext(ctx context.Context) (*sql.Rows, error) { - if d.RunWith == nil { - return nil, RunnerNotSet - } - ctxRunner, ok := d.RunWith.(QueryerContext) - if !ok { - return nil, NoContextSupport - } - return QueryContextWith(ctx, ctxRunner, d) -} - -func (d *insertData) QueryRowContext(ctx context.Context) RowScanner { - if d.RunWith == nil { - return &Row{err: RunnerNotSet} - } - queryRower, ok := d.RunWith.(QueryRowerContext) - if !ok { - if _, ok := d.RunWith.(QueryerContext); !ok { - return &Row{err: RunnerNotQueryRunner} - } - return &Row{err: NoContextSupport} - } - return QueryRowContextWith(ctx, queryRower, d) -} - -// ExecContext builds and ExecContexts the query with the Runner set by RunWith. -func (b InsertBuilder) ExecContext(ctx context.Context) (sql.Result, error) { - data := builder.GetStruct(b).(insertData) - return data.ExecContext(ctx) -} - -// QueryContext builds and QueryContexts the query with the Runner set by RunWith. -func (b InsertBuilder) QueryContext(ctx context.Context) (*sql.Rows, error) { - data := builder.GetStruct(b).(insertData) - return data.QueryContext(ctx) -} - -// QueryRowContext builds and QueryRowContexts the query with the Runner set by RunWith. -func (b InsertBuilder) QueryRowContext(ctx context.Context) RowScanner { - data := builder.GetStruct(b).(insertData) - return data.QueryRowContext(ctx) -} - -// ScanContext is a shortcut for QueryRowContext().Scan. -func (b InsertBuilder) ScanContext(ctx context.Context, dest ...interface{}) error { - return b.QueryRowContext(ctx).Scan(dest...) -} diff --git a/vendor/github.com/Masterminds/squirrel/part.go b/vendor/github.com/Masterminds/squirrel/part.go deleted file mode 100644 index c58f68f..0000000 --- a/vendor/github.com/Masterminds/squirrel/part.go +++ /dev/null @@ -1,63 +0,0 @@ -package squirrel - -import ( - "fmt" - "io" -) - -type part struct { - pred interface{} - args []interface{} -} - -func newPart(pred interface{}, args ...interface{}) Sqlizer { - return &part{pred, args} -} - -func (p part) ToSql() (sql string, args []interface{}, err error) { - switch pred := p.pred.(type) { - case nil: - // no-op - case Sqlizer: - sql, args, err = nestedToSql(pred) - case string: - sql = pred - args = p.args - default: - err = fmt.Errorf("expected string or Sqlizer, not %T", pred) - } - return -} - -func nestedToSql(s Sqlizer) (string, []interface{}, error) { - if raw, ok := s.(rawSqlizer); ok { - return raw.toSqlRaw() - } else { - return s.ToSql() - } -} - -func appendToSql(parts []Sqlizer, w io.Writer, sep string, args []interface{}) ([]interface{}, error) { - for i, p := range parts { - partSql, partArgs, err := nestedToSql(p) - if err != nil { - return nil, err - } else if len(partSql) == 0 { - continue - } - - if i > 0 { - _, err := io.WriteString(w, sep) - if err != nil { - return nil, err - } - } - - _, err = io.WriteString(w, partSql) - if err != nil { - return nil, err - } - args = append(args, partArgs...) - } - return args, nil -} diff --git a/vendor/github.com/Masterminds/squirrel/placeholder.go b/vendor/github.com/Masterminds/squirrel/placeholder.go deleted file mode 100644 index 8e97a6c..0000000 --- a/vendor/github.com/Masterminds/squirrel/placeholder.go +++ /dev/null @@ -1,114 +0,0 @@ -package squirrel - -import ( - "bytes" - "fmt" - "strings" -) - -// PlaceholderFormat is the interface that wraps the ReplacePlaceholders method. -// -// ReplacePlaceholders takes a SQL statement and replaces each question mark -// placeholder with a (possibly different) SQL placeholder. -type PlaceholderFormat interface { - ReplacePlaceholders(sql string) (string, error) -} - -type placeholderDebugger interface { - debugPlaceholder() string -} - -var ( - // Question is a PlaceholderFormat instance that leaves placeholders as - // question marks. - Question = questionFormat{} - - // Dollar is a PlaceholderFormat instance that replaces placeholders with - // dollar-prefixed positional placeholders (e.g. $1, $2, $3). - Dollar = dollarFormat{} - - // Colon is a PlaceholderFormat instance that replaces placeholders with - // colon-prefixed positional placeholders (e.g. :1, :2, :3). - Colon = colonFormat{} - - // AtP is a PlaceholderFormat instance that replaces placeholders with - // "@p"-prefixed positional placeholders (e.g. @p1, @p2, @p3). - AtP = atpFormat{} -) - -type questionFormat struct{} - -func (questionFormat) ReplacePlaceholders(sql string) (string, error) { - return sql, nil -} - -func (questionFormat) debugPlaceholder() string { - return "?" -} - -type dollarFormat struct{} - -func (dollarFormat) ReplacePlaceholders(sql string) (string, error) { - return replacePositionalPlaceholders(sql, "$") -} - -func (dollarFormat) debugPlaceholder() string { - return "$" -} - -type colonFormat struct{} - -func (colonFormat) ReplacePlaceholders(sql string) (string, error) { - return replacePositionalPlaceholders(sql, ":") -} - -func (colonFormat) debugPlaceholder() string { - return ":" -} - -type atpFormat struct{} - -func (atpFormat) ReplacePlaceholders(sql string) (string, error) { - return replacePositionalPlaceholders(sql, "@p") -} - -func (atpFormat) debugPlaceholder() string { - return "@p" -} - -// Placeholders returns a string with count ? placeholders joined with commas. -func Placeholders(count int) string { - if count < 1 { - return "" - } - - return strings.Repeat(",?", count)[1:] -} - -func replacePositionalPlaceholders(sql, prefix string) (string, error) { - buf := &bytes.Buffer{} - i := 0 - for { - p := strings.Index(sql, "?") - if p == -1 { - break - } - - if len(sql[p:]) > 1 && sql[p:p+2] == "??" { // escape ?? => ? - buf.WriteString(sql[:p]) - buf.WriteString("?") - if len(sql[p:]) == 1 { - break - } - sql = sql[p+2:] - } else { - i++ - buf.WriteString(sql[:p]) - fmt.Fprintf(buf, "%s%d", prefix, i) - sql = sql[p+1:] - } - } - - buf.WriteString(sql) - return buf.String(), nil -} diff --git a/vendor/github.com/Masterminds/squirrel/row.go b/vendor/github.com/Masterminds/squirrel/row.go deleted file mode 100644 index 74ffda9..0000000 --- a/vendor/github.com/Masterminds/squirrel/row.go +++ /dev/null @@ -1,22 +0,0 @@ -package squirrel - -// RowScanner is the interface that wraps the Scan method. -// -// Scan behaves like database/sql.Row.Scan. -type RowScanner interface { - Scan(...interface{}) error -} - -// Row wraps database/sql.Row to let squirrel return new errors on Scan. -type Row struct { - RowScanner - err error -} - -// Scan returns Row.err or calls RowScanner.Scan. -func (r *Row) Scan(dest ...interface{}) error { - if r.err != nil { - return r.err - } - return r.RowScanner.Scan(dest...) -} diff --git a/vendor/github.com/Masterminds/squirrel/select.go b/vendor/github.com/Masterminds/squirrel/select.go deleted file mode 100644 index b585344..0000000 --- a/vendor/github.com/Masterminds/squirrel/select.go +++ /dev/null @@ -1,396 +0,0 @@ -package squirrel - -import ( - "bytes" - "database/sql" - "fmt" - "strings" - - "github.com/lann/builder" -) - -type selectData struct { - PlaceholderFormat PlaceholderFormat - RunWith BaseRunner - Prefixes []Sqlizer - Options []string - Columns []Sqlizer - From Sqlizer - Joins []Sqlizer - WhereParts []Sqlizer - GroupBys []string - HavingParts []Sqlizer - OrderByParts []Sqlizer - Limit string - Offset string - Suffixes []Sqlizer -} - -func (d *selectData) Exec() (sql.Result, error) { - if d.RunWith == nil { - return nil, RunnerNotSet - } - return ExecWith(d.RunWith, d) -} - -func (d *selectData) Query() (*sql.Rows, error) { - if d.RunWith == nil { - return nil, RunnerNotSet - } - return QueryWith(d.RunWith, d) -} - -func (d *selectData) QueryRow() RowScanner { - if d.RunWith == nil { - return &Row{err: RunnerNotSet} - } - queryRower, ok := d.RunWith.(QueryRower) - if !ok { - return &Row{err: RunnerNotQueryRunner} - } - return QueryRowWith(queryRower, d) -} - -func (d *selectData) ToSql() (sqlStr string, args []interface{}, err error) { - sqlStr, args, err = d.toSqlRaw() - if err != nil { - return - } - - sqlStr, err = d.PlaceholderFormat.ReplacePlaceholders(sqlStr) - return -} - -func (d *selectData) toSqlRaw() (sqlStr string, args []interface{}, err error) { - if len(d.Columns) == 0 { - err = fmt.Errorf("select statements must have at least one result column") - return - } - - sql := &bytes.Buffer{} - - if len(d.Prefixes) > 0 { - args, err = appendToSql(d.Prefixes, sql, " ", args) - if err != nil { - return - } - - sql.WriteString(" ") - } - - sql.WriteString("SELECT ") - - if len(d.Options) > 0 { - sql.WriteString(strings.Join(d.Options, " ")) - sql.WriteString(" ") - } - - if len(d.Columns) > 0 { - args, err = appendToSql(d.Columns, sql, ", ", args) - if err != nil { - return - } - } - - if d.From != nil { - sql.WriteString(" FROM ") - args, err = appendToSql([]Sqlizer{d.From}, sql, "", args) - if err != nil { - return - } - } - - if len(d.Joins) > 0 { - sql.WriteString(" ") - args, err = appendToSql(d.Joins, sql, " ", args) - if err != nil { - return - } - } - - if len(d.WhereParts) > 0 { - sql.WriteString(" WHERE ") - args, err = appendToSql(d.WhereParts, sql, " AND ", args) - if err != nil { - return - } - } - - if len(d.GroupBys) > 0 { - sql.WriteString(" GROUP BY ") - sql.WriteString(strings.Join(d.GroupBys, ", ")) - } - - if len(d.HavingParts) > 0 { - sql.WriteString(" HAVING ") - args, err = appendToSql(d.HavingParts, sql, " AND ", args) - if err != nil { - return - } - } - - if len(d.OrderByParts) > 0 { - sql.WriteString(" ORDER BY ") - args, err = appendToSql(d.OrderByParts, sql, ", ", args) - if err != nil { - return - } - } - - if len(d.Limit) > 0 { - sql.WriteString(" LIMIT ") - sql.WriteString(d.Limit) - } - - if len(d.Offset) > 0 { - sql.WriteString(" OFFSET ") - sql.WriteString(d.Offset) - } - - if len(d.Suffixes) > 0 { - sql.WriteString(" ") - - args, err = appendToSql(d.Suffixes, sql, " ", args) - if err != nil { - return - } - } - - sqlStr = sql.String() - return -} - -// Builder - -// SelectBuilder builds SQL SELECT statements. -type SelectBuilder builder.Builder - -func init() { - builder.Register(SelectBuilder{}, selectData{}) -} - -// Format methods - -// PlaceholderFormat sets PlaceholderFormat (e.g. Question or Dollar) for the -// query. -func (b SelectBuilder) PlaceholderFormat(f PlaceholderFormat) SelectBuilder { - return builder.Set(b, "PlaceholderFormat", f).(SelectBuilder) -} - -// Runner methods - -// RunWith sets a Runner (like database/sql.DB) to be used with e.g. Exec. -// For most cases runner will be a database connection. -// -// Internally we use this to mock out the database connection for testing. -func (b SelectBuilder) RunWith(runner BaseRunner) SelectBuilder { - return setRunWith(b, runner).(SelectBuilder) -} - -// Exec builds and Execs the query with the Runner set by RunWith. -func (b SelectBuilder) Exec() (sql.Result, error) { - data := builder.GetStruct(b).(selectData) - return data.Exec() -} - -// Query builds and Querys the query with the Runner set by RunWith. -func (b SelectBuilder) Query() (*sql.Rows, error) { - data := builder.GetStruct(b).(selectData) - return data.Query() -} - -// QueryRow builds and QueryRows the query with the Runner set by RunWith. -func (b SelectBuilder) QueryRow() RowScanner { - data := builder.GetStruct(b).(selectData) - return data.QueryRow() -} - -// Scan is a shortcut for QueryRow().Scan. -func (b SelectBuilder) Scan(dest ...interface{}) error { - return b.QueryRow().Scan(dest...) -} - -// SQL methods - -// ToSql builds the query into a SQL string and bound args. -func (b SelectBuilder) ToSql() (string, []interface{}, error) { - data := builder.GetStruct(b).(selectData) - return data.ToSql() -} - -func (b SelectBuilder) toSqlRaw() (string, []interface{}, error) { - data := builder.GetStruct(b).(selectData) - return data.toSqlRaw() -} - -// MustSql builds the query into a SQL string and bound args. -// It panics if there are any errors. -func (b SelectBuilder) MustSql() (string, []interface{}) { - sql, args, err := b.ToSql() - if err != nil { - panic(err) - } - return sql, args -} - -// Prefix adds an expression to the beginning of the query -func (b SelectBuilder) Prefix(sql string, args ...interface{}) SelectBuilder { - return b.PrefixExpr(Expr(sql, args...)) -} - -// PrefixExpr adds an expression to the very beginning of the query -func (b SelectBuilder) PrefixExpr(expr Sqlizer) SelectBuilder { - return builder.Append(b, "Prefixes", expr).(SelectBuilder) -} - -// Distinct adds a DISTINCT clause to the query. -func (b SelectBuilder) Distinct() SelectBuilder { - return b.Options("DISTINCT") -} - -// Options adds select option to the query -func (b SelectBuilder) Options(options ...string) SelectBuilder { - return builder.Extend(b, "Options", options).(SelectBuilder) -} - -// Columns adds result columns to the query. -func (b SelectBuilder) Columns(columns ...string) SelectBuilder { - parts := make([]interface{}, 0, len(columns)) - for _, str := range columns { - parts = append(parts, newPart(str)) - } - return builder.Extend(b, "Columns", parts).(SelectBuilder) -} - -// Column adds a result column to the query. -// Unlike Columns, Column accepts args which will be bound to placeholders in -// the columns string, for example: -// Column("IF(col IN ("+squirrel.Placeholders(3)+"), 1, 0) as col", 1, 2, 3) -func (b SelectBuilder) Column(column interface{}, args ...interface{}) SelectBuilder { - return builder.Append(b, "Columns", newPart(column, args...)).(SelectBuilder) -} - -// From sets the FROM clause of the query. -func (b SelectBuilder) From(from string) SelectBuilder { - return builder.Set(b, "From", newPart(from)).(SelectBuilder) -} - -// FromSelect sets a subquery into the FROM clause of the query. -func (b SelectBuilder) FromSelect(from SelectBuilder, alias string) SelectBuilder { - // Prevent misnumbered parameters in nested selects (#183). - from = from.PlaceholderFormat(Question) - return builder.Set(b, "From", Alias(from, alias)).(SelectBuilder) -} - -// JoinClause adds a join clause to the query. -func (b SelectBuilder) JoinClause(pred interface{}, args ...interface{}) SelectBuilder { - return builder.Append(b, "Joins", newPart(pred, args...)).(SelectBuilder) -} - -// Join adds a JOIN clause to the query. -func (b SelectBuilder) Join(join string, rest ...interface{}) SelectBuilder { - return b.JoinClause("JOIN "+join, rest...) -} - -// LeftJoin adds a LEFT JOIN clause to the query. -func (b SelectBuilder) LeftJoin(join string, rest ...interface{}) SelectBuilder { - return b.JoinClause("LEFT JOIN "+join, rest...) -} - -// RightJoin adds a RIGHT JOIN clause to the query. -func (b SelectBuilder) RightJoin(join string, rest ...interface{}) SelectBuilder { - return b.JoinClause("RIGHT JOIN "+join, rest...) -} - -// InnerJoin adds a INNER JOIN clause to the query. -func (b SelectBuilder) InnerJoin(join string, rest ...interface{}) SelectBuilder { - return b.JoinClause("INNER JOIN "+join, rest...) -} - -// CrossJoin adds a CROSS JOIN clause to the query. -func (b SelectBuilder) CrossJoin(join string, rest ...interface{}) SelectBuilder { - return b.JoinClause("CROSS JOIN "+join, rest...) -} - -// Where adds an expression to the WHERE clause of the query. -// -// Expressions are ANDed together in the generated SQL. -// -// Where accepts several types for its pred argument: -// -// nil OR "" - ignored. -// -// string - SQL expression. -// If the expression has SQL placeholders then a set of arguments must be passed -// as well, one for each placeholder. -// -// map[string]interface{} OR Eq - map of SQL expressions to values. Each key is -// transformed into an expression like " = ?", with the corresponding value -// bound to the placeholder. If the value is nil, the expression will be " -// IS NULL". If the value is an array or slice, the expression will be " IN -// (?,?,...)", with one placeholder for each item in the value. These expressions -// are ANDed together. -// -// Where will panic if pred isn't any of the above types. -func (b SelectBuilder) Where(pred interface{}, args ...interface{}) SelectBuilder { - if pred == nil || pred == "" { - return b - } - return builder.Append(b, "WhereParts", newWherePart(pred, args...)).(SelectBuilder) -} - -// GroupBy adds GROUP BY expressions to the query. -func (b SelectBuilder) GroupBy(groupBys ...string) SelectBuilder { - return builder.Extend(b, "GroupBys", groupBys).(SelectBuilder) -} - -// Having adds an expression to the HAVING clause of the query. -// -// See Where. -func (b SelectBuilder) Having(pred interface{}, rest ...interface{}) SelectBuilder { - return builder.Append(b, "HavingParts", newWherePart(pred, rest...)).(SelectBuilder) -} - -// OrderByClause adds ORDER BY clause to the query. -func (b SelectBuilder) OrderByClause(pred interface{}, args ...interface{}) SelectBuilder { - return builder.Append(b, "OrderByParts", newPart(pred, args...)).(SelectBuilder) -} - -// OrderBy adds ORDER BY expressions to the query. -func (b SelectBuilder) OrderBy(orderBys ...string) SelectBuilder { - for _, orderBy := range orderBys { - b = b.OrderByClause(orderBy) - } - - return b -} - -// Limit sets a LIMIT clause on the query. -func (b SelectBuilder) Limit(limit uint64) SelectBuilder { - return builder.Set(b, "Limit", fmt.Sprintf("%d", limit)).(SelectBuilder) -} - -// Limit ALL allows to access all records with limit -func (b SelectBuilder) RemoveLimit() SelectBuilder { - return builder.Delete(b, "Limit").(SelectBuilder) -} - -// Offset sets a OFFSET clause on the query. -func (b SelectBuilder) Offset(offset uint64) SelectBuilder { - return builder.Set(b, "Offset", fmt.Sprintf("%d", offset)).(SelectBuilder) -} - -// RemoveOffset removes OFFSET clause. -func (b SelectBuilder) RemoveOffset() SelectBuilder { - return builder.Delete(b, "Offset").(SelectBuilder) -} - -// Suffix adds an expression to the end of the query -func (b SelectBuilder) Suffix(sql string, args ...interface{}) SelectBuilder { - return b.SuffixExpr(Expr(sql, args...)) -} - -// SuffixExpr adds an expression to the end of the query -func (b SelectBuilder) SuffixExpr(expr Sqlizer) SelectBuilder { - return builder.Append(b, "Suffixes", expr).(SelectBuilder) -} diff --git a/vendor/github.com/Masterminds/squirrel/select_ctx.go b/vendor/github.com/Masterminds/squirrel/select_ctx.go deleted file mode 100644 index 4c42c13..0000000 --- a/vendor/github.com/Masterminds/squirrel/select_ctx.go +++ /dev/null @@ -1,69 +0,0 @@ -// +build go1.8 - -package squirrel - -import ( - "context" - "database/sql" - - "github.com/lann/builder" -) - -func (d *selectData) ExecContext(ctx context.Context) (sql.Result, error) { - if d.RunWith == nil { - return nil, RunnerNotSet - } - ctxRunner, ok := d.RunWith.(ExecerContext) - if !ok { - return nil, NoContextSupport - } - return ExecContextWith(ctx, ctxRunner, d) -} - -func (d *selectData) QueryContext(ctx context.Context) (*sql.Rows, error) { - if d.RunWith == nil { - return nil, RunnerNotSet - } - ctxRunner, ok := d.RunWith.(QueryerContext) - if !ok { - return nil, NoContextSupport - } - return QueryContextWith(ctx, ctxRunner, d) -} - -func (d *selectData) QueryRowContext(ctx context.Context) RowScanner { - if d.RunWith == nil { - return &Row{err: RunnerNotSet} - } - queryRower, ok := d.RunWith.(QueryRowerContext) - if !ok { - if _, ok := d.RunWith.(QueryerContext); !ok { - return &Row{err: RunnerNotQueryRunner} - } - return &Row{err: NoContextSupport} - } - return QueryRowContextWith(ctx, queryRower, d) -} - -// ExecContext builds and ExecContexts the query with the Runner set by RunWith. -func (b SelectBuilder) ExecContext(ctx context.Context) (sql.Result, error) { - data := builder.GetStruct(b).(selectData) - return data.ExecContext(ctx) -} - -// QueryContext builds and QueryContexts the query with the Runner set by RunWith. -func (b SelectBuilder) QueryContext(ctx context.Context) (*sql.Rows, error) { - data := builder.GetStruct(b).(selectData) - return data.QueryContext(ctx) -} - -// QueryRowContext builds and QueryRowContexts the query with the Runner set by RunWith. -func (b SelectBuilder) QueryRowContext(ctx context.Context) RowScanner { - data := builder.GetStruct(b).(selectData) - return data.QueryRowContext(ctx) -} - -// ScanContext is a shortcut for QueryRowContext().Scan. -func (b SelectBuilder) ScanContext(ctx context.Context, dest ...interface{}) error { - return b.QueryRowContext(ctx).Scan(dest...) -} diff --git a/vendor/github.com/Masterminds/squirrel/squirrel.go b/vendor/github.com/Masterminds/squirrel/squirrel.go deleted file mode 100644 index 46d456e..0000000 --- a/vendor/github.com/Masterminds/squirrel/squirrel.go +++ /dev/null @@ -1,183 +0,0 @@ -// Package squirrel provides a fluent SQL generator. -// -// See https://github.com/Masterminds/squirrel for examples. -package squirrel - -import ( - "bytes" - "database/sql" - "fmt" - "strings" - - "github.com/lann/builder" -) - -// Sqlizer is the interface that wraps the ToSql method. -// -// ToSql returns a SQL representation of the Sqlizer, along with a slice of args -// as passed to e.g. database/sql.Exec. It can also return an error. -type Sqlizer interface { - ToSql() (string, []interface{}, error) -} - -// rawSqlizer is expected to do what Sqlizer does, but without finalizing placeholders. -// This is useful for nested queries. -type rawSqlizer interface { - toSqlRaw() (string, []interface{}, error) -} - -// Execer is the interface that wraps the Exec method. -// -// Exec executes the given query as implemented by database/sql.Exec. -type Execer interface { - Exec(query string, args ...interface{}) (sql.Result, error) -} - -// Queryer is the interface that wraps the Query method. -// -// Query executes the given query as implemented by database/sql.Query. -type Queryer interface { - Query(query string, args ...interface{}) (*sql.Rows, error) -} - -// QueryRower is the interface that wraps the QueryRow method. -// -// QueryRow executes the given query as implemented by database/sql.QueryRow. -type QueryRower interface { - QueryRow(query string, args ...interface{}) RowScanner -} - -// BaseRunner groups the Execer and Queryer interfaces. -type BaseRunner interface { - Execer - Queryer -} - -// Runner groups the Execer, Queryer, and QueryRower interfaces. -type Runner interface { - Execer - Queryer - QueryRower -} - -// WrapStdSql wraps a type implementing the standard SQL interface with methods that -// squirrel expects. -func WrapStdSql(stdSql StdSql) Runner { - return &stdsqlRunner{stdSql} -} - -// StdSql encompasses the standard methods of the *sql.DB type, and other types that -// wrap these methods. -type StdSql interface { - Query(string, ...interface{}) (*sql.Rows, error) - QueryRow(string, ...interface{}) *sql.Row - Exec(string, ...interface{}) (sql.Result, error) -} - -type stdsqlRunner struct { - StdSql -} - -func (r *stdsqlRunner) QueryRow(query string, args ...interface{}) RowScanner { - return r.StdSql.QueryRow(query, args...) -} - -func setRunWith(b interface{}, runner BaseRunner) interface{} { - switch r := runner.(type) { - case StdSqlCtx: - runner = WrapStdSqlCtx(r) - case StdSql: - runner = WrapStdSql(r) - } - return builder.Set(b, "RunWith", runner) -} - -// RunnerNotSet is returned by methods that need a Runner if it isn't set. -var RunnerNotSet = fmt.Errorf("cannot run; no Runner set (RunWith)") - -// RunnerNotQueryRunner is returned by QueryRow if the RunWith value doesn't implement QueryRower. -var RunnerNotQueryRunner = fmt.Errorf("cannot QueryRow; Runner is not a QueryRower") - -// ExecWith Execs the SQL returned by s with db. -func ExecWith(db Execer, s Sqlizer) (res sql.Result, err error) { - query, args, err := s.ToSql() - if err != nil { - return - } - return db.Exec(query, args...) -} - -// QueryWith Querys the SQL returned by s with db. -func QueryWith(db Queryer, s Sqlizer) (rows *sql.Rows, err error) { - query, args, err := s.ToSql() - if err != nil { - return - } - return db.Query(query, args...) -} - -// QueryRowWith QueryRows the SQL returned by s with db. -func QueryRowWith(db QueryRower, s Sqlizer) RowScanner { - query, args, err := s.ToSql() - return &Row{RowScanner: db.QueryRow(query, args...), err: err} -} - -// DebugSqlizer calls ToSql on s and shows the approximate SQL to be executed -// -// If ToSql returns an error, the result of this method will look like: -// "[ToSql error: %s]" or "[DebugSqlizer error: %s]" -// -// IMPORTANT: As its name suggests, this function should only be used for -// debugging. While the string result *might* be valid SQL, this function does -// not try very hard to ensure it. Additionally, executing the output of this -// function with any untrusted user input is certainly insecure. -func DebugSqlizer(s Sqlizer) string { - sql, args, err := s.ToSql() - if err != nil { - return fmt.Sprintf("[ToSql error: %s]", err) - } - - var placeholder string - downCast, ok := s.(placeholderDebugger) - if !ok { - placeholder = "?" - } else { - placeholder = downCast.debugPlaceholder() - } - // TODO: dedupe this with placeholder.go - buf := &bytes.Buffer{} - i := 0 - for { - p := strings.Index(sql, placeholder) - if p == -1 { - break - } - if len(sql[p:]) > 1 && sql[p:p+2] == "??" { // escape ?? => ? - buf.WriteString(sql[:p]) - buf.WriteString("?") - if len(sql[p:]) == 1 { - break - } - sql = sql[p+2:] - } else { - if i+1 > len(args) { - return fmt.Sprintf( - "[DebugSqlizer error: too many placeholders in %#v for %d args]", - sql, len(args)) - } - buf.WriteString(sql[:p]) - fmt.Fprintf(buf, "'%v'", args[i]) - // advance our sql string "cursor" beyond the arg we placed - sql = sql[p+1:] - i++ - } - } - if i < len(args) { - return fmt.Sprintf( - "[DebugSqlizer error: not enough placeholders in %#v for %d args]", - sql, len(args)) - } - // "append" any remaning sql that won't need interpolating - buf.WriteString(sql) - return buf.String() -} diff --git a/vendor/github.com/Masterminds/squirrel/squirrel_ctx.go b/vendor/github.com/Masterminds/squirrel/squirrel_ctx.go deleted file mode 100644 index c20148a..0000000 --- a/vendor/github.com/Masterminds/squirrel/squirrel_ctx.go +++ /dev/null @@ -1,93 +0,0 @@ -// +build go1.8 - -package squirrel - -import ( - "context" - "database/sql" - "errors" -) - -// NoContextSupport is returned if a db doesn't support Context. -var NoContextSupport = errors.New("DB does not support Context") - -// ExecerContext is the interface that wraps the ExecContext method. -// -// Exec executes the given query as implemented by database/sql.ExecContext. -type ExecerContext interface { - ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) -} - -// QueryerContext is the interface that wraps the QueryContext method. -// -// QueryContext executes the given query as implemented by database/sql.QueryContext. -type QueryerContext interface { - QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) -} - -// QueryRowerContext is the interface that wraps the QueryRowContext method. -// -// QueryRowContext executes the given query as implemented by database/sql.QueryRowContext. -type QueryRowerContext interface { - QueryRowContext(ctx context.Context, query string, args ...interface{}) RowScanner -} - -// RunnerContext groups the Runner interface, along with the Context versions of each of -// its methods -type RunnerContext interface { - Runner - QueryerContext - QueryRowerContext - ExecerContext -} - -// WrapStdSqlCtx wraps a type implementing the standard SQL interface plus the context -// versions of the methods with methods that squirrel expects. -func WrapStdSqlCtx(stdSqlCtx StdSqlCtx) RunnerContext { - return &stdsqlCtxRunner{stdSqlCtx} -} - -// StdSqlCtx encompasses the standard methods of the *sql.DB type, along with the Context -// versions of those methods, and other types that wrap these methods. -type StdSqlCtx interface { - StdSql - QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) - QueryRowContext(context.Context, string, ...interface{}) *sql.Row - ExecContext(context.Context, string, ...interface{}) (sql.Result, error) -} - -type stdsqlCtxRunner struct { - StdSqlCtx -} - -func (r *stdsqlCtxRunner) QueryRow(query string, args ...interface{}) RowScanner { - return r.StdSqlCtx.QueryRow(query, args...) -} - -func (r *stdsqlCtxRunner) QueryRowContext(ctx context.Context, query string, args ...interface{}) RowScanner { - return r.StdSqlCtx.QueryRowContext(ctx, query, args...) -} - -// ExecContextWith ExecContexts the SQL returned by s with db. -func ExecContextWith(ctx context.Context, db ExecerContext, s Sqlizer) (res sql.Result, err error) { - query, args, err := s.ToSql() - if err != nil { - return - } - return db.ExecContext(ctx, query, args...) -} - -// QueryContextWith QueryContexts the SQL returned by s with db. -func QueryContextWith(ctx context.Context, db QueryerContext, s Sqlizer) (rows *sql.Rows, err error) { - query, args, err := s.ToSql() - if err != nil { - return - } - return db.QueryContext(ctx, query, args...) -} - -// QueryRowContextWith QueryRowContexts the SQL returned by s with db. -func QueryRowContextWith(ctx context.Context, db QueryRowerContext, s Sqlizer) RowScanner { - query, args, err := s.ToSql() - return &Row{RowScanner: db.QueryRowContext(ctx, query, args...), err: err} -} diff --git a/vendor/github.com/Masterminds/squirrel/statement.go b/vendor/github.com/Masterminds/squirrel/statement.go deleted file mode 100644 index 9420c67..0000000 --- a/vendor/github.com/Masterminds/squirrel/statement.go +++ /dev/null @@ -1,104 +0,0 @@ -package squirrel - -import "github.com/lann/builder" - -// StatementBuilderType is the type of StatementBuilder. -type StatementBuilderType builder.Builder - -// Select returns a SelectBuilder for this StatementBuilderType. -func (b StatementBuilderType) Select(columns ...string) SelectBuilder { - return SelectBuilder(b).Columns(columns...) -} - -// Insert returns a InsertBuilder for this StatementBuilderType. -func (b StatementBuilderType) Insert(into string) InsertBuilder { - return InsertBuilder(b).Into(into) -} - -// Replace returns a InsertBuilder for this StatementBuilderType with the -// statement keyword set to "REPLACE". -func (b StatementBuilderType) Replace(into string) InsertBuilder { - return InsertBuilder(b).statementKeyword("REPLACE").Into(into) -} - -// Update returns a UpdateBuilder for this StatementBuilderType. -func (b StatementBuilderType) Update(table string) UpdateBuilder { - return UpdateBuilder(b).Table(table) -} - -// Delete returns a DeleteBuilder for this StatementBuilderType. -func (b StatementBuilderType) Delete(from string) DeleteBuilder { - return DeleteBuilder(b).From(from) -} - -// PlaceholderFormat sets the PlaceholderFormat field for any child builders. -func (b StatementBuilderType) PlaceholderFormat(f PlaceholderFormat) StatementBuilderType { - return builder.Set(b, "PlaceholderFormat", f).(StatementBuilderType) -} - -// RunWith sets the RunWith field for any child builders. -func (b StatementBuilderType) RunWith(runner BaseRunner) StatementBuilderType { - return setRunWith(b, runner).(StatementBuilderType) -} - -// Where adds WHERE expressions to the query. -// -// See SelectBuilder.Where for more information. -func (b StatementBuilderType) Where(pred interface{}, args ...interface{}) StatementBuilderType { - return builder.Append(b, "WhereParts", newWherePart(pred, args...)).(StatementBuilderType) -} - -// StatementBuilder is a parent builder for other builders, e.g. SelectBuilder. -var StatementBuilder = StatementBuilderType(builder.EmptyBuilder).PlaceholderFormat(Question) - -// Select returns a new SelectBuilder, optionally setting some result columns. -// -// See SelectBuilder.Columns. -func Select(columns ...string) SelectBuilder { - return StatementBuilder.Select(columns...) -} - -// Insert returns a new InsertBuilder with the given table name. -// -// See InsertBuilder.Into. -func Insert(into string) InsertBuilder { - return StatementBuilder.Insert(into) -} - -// Replace returns a new InsertBuilder with the statement keyword set to -// "REPLACE" and with the given table name. -// -// See InsertBuilder.Into. -func Replace(into string) InsertBuilder { - return StatementBuilder.Replace(into) -} - -// Update returns a new UpdateBuilder with the given table name. -// -// See UpdateBuilder.Table. -func Update(table string) UpdateBuilder { - return StatementBuilder.Update(table) -} - -// Delete returns a new DeleteBuilder with the given table name. -// -// See DeleteBuilder.Table. -func Delete(from string) DeleteBuilder { - return StatementBuilder.Delete(from) -} - -// Case returns a new CaseBuilder -// "what" represents case value -func Case(what ...interface{}) CaseBuilder { - b := CaseBuilder(builder.EmptyBuilder) - - switch len(what) { - case 0: - case 1: - b = b.what(what[0]) - default: - b = b.what(newPart(what[0], what[1:]...)) - - } - return b -} diff --git a/vendor/github.com/Masterminds/squirrel/stmtcacher.go b/vendor/github.com/Masterminds/squirrel/stmtcacher.go deleted file mode 100644 index 5bf267a..0000000 --- a/vendor/github.com/Masterminds/squirrel/stmtcacher.go +++ /dev/null @@ -1,121 +0,0 @@ -package squirrel - -import ( - "database/sql" - "fmt" - "sync" -) - -// Prepareer is the interface that wraps the Prepare method. -// -// Prepare executes the given query as implemented by database/sql.Prepare. -type Preparer interface { - Prepare(query string) (*sql.Stmt, error) -} - -// DBProxy groups the Execer, Queryer, QueryRower, and Preparer interfaces. -type DBProxy interface { - Execer - Queryer - QueryRower - Preparer -} - -// NOTE: NewStmtCache is defined in stmtcacher_ctx.go (Go >= 1.8) or stmtcacher_noctx.go (Go < 1.8). - -// StmtCache wraps and delegates down to a Preparer type -// -// It also automatically prepares all statements sent to the underlying Preparer calls -// for Exec, Query and QueryRow and caches the returns *sql.Stmt using the provided -// query as the key. So that it can be automatically re-used. -type StmtCache struct { - prep Preparer - cache map[string]*sql.Stmt - mu sync.Mutex -} - -// Prepare delegates down to the underlying Preparer and caches the result -// using the provided query as a key -func (sc *StmtCache) Prepare(query string) (*sql.Stmt, error) { - sc.mu.Lock() - defer sc.mu.Unlock() - - stmt, ok := sc.cache[query] - if ok { - return stmt, nil - } - stmt, err := sc.prep.Prepare(query) - if err == nil { - sc.cache[query] = stmt - } - return stmt, err -} - -// Exec delegates down to the underlying Preparer using a prepared statement -func (sc *StmtCache) Exec(query string, args ...interface{}) (res sql.Result, err error) { - stmt, err := sc.Prepare(query) - if err != nil { - return - } - return stmt.Exec(args...) -} - -// Query delegates down to the underlying Preparer using a prepared statement -func (sc *StmtCache) Query(query string, args ...interface{}) (rows *sql.Rows, err error) { - stmt, err := sc.Prepare(query) - if err != nil { - return - } - return stmt.Query(args...) -} - -// QueryRow delegates down to the underlying Preparer using a prepared statement -func (sc *StmtCache) QueryRow(query string, args ...interface{}) RowScanner { - stmt, err := sc.Prepare(query) - if err != nil { - return &Row{err: err} - } - return stmt.QueryRow(args...) -} - -// Clear removes and closes all the currently cached prepared statements -func (sc *StmtCache) Clear() (err error) { - sc.mu.Lock() - defer sc.mu.Unlock() - - for key, stmt := range sc.cache { - delete(sc.cache, key) - - if stmt == nil { - continue - } - - if cerr := stmt.Close(); cerr != nil { - err = cerr - } - } - - if err != nil { - return fmt.Errorf("one or more Stmt.Close failed; last error: %v", err) - } - - return -} - -type DBProxyBeginner interface { - DBProxy - Begin() (*sql.Tx, error) -} - -type stmtCacheProxy struct { - DBProxy - db *sql.DB -} - -func NewStmtCacheProxy(db *sql.DB) DBProxyBeginner { - return &stmtCacheProxy{DBProxy: NewStmtCache(db), db: db} -} - -func (sp *stmtCacheProxy) Begin() (*sql.Tx, error) { - return sp.db.Begin() -} diff --git a/vendor/github.com/Masterminds/squirrel/stmtcacher_ctx.go b/vendor/github.com/Masterminds/squirrel/stmtcacher_ctx.go deleted file mode 100644 index 53603cf..0000000 --- a/vendor/github.com/Masterminds/squirrel/stmtcacher_ctx.go +++ /dev/null @@ -1,86 +0,0 @@ -// +build go1.8 - -package squirrel - -import ( - "context" - "database/sql" -) - -// PrepareerContext is the interface that wraps the Prepare and PrepareContext methods. -// -// Prepare executes the given query as implemented by database/sql.Prepare. -// PrepareContext executes the given query as implemented by database/sql.PrepareContext. -type PreparerContext interface { - Preparer - PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) -} - -// DBProxyContext groups the Execer, Queryer, QueryRower and PreparerContext interfaces. -type DBProxyContext interface { - Execer - Queryer - QueryRower - PreparerContext -} - -// NewStmtCache returns a *StmtCache wrapping a PreparerContext that caches Prepared Stmts. -// -// Stmts are cached based on the string value of their queries. -func NewStmtCache(prep PreparerContext) *StmtCache { - return &StmtCache{prep: prep, cache: make(map[string]*sql.Stmt)} -} - -// NewStmtCacher is deprecated -// -// Use NewStmtCache instead -func NewStmtCacher(prep PreparerContext) DBProxyContext { - return NewStmtCache(prep) -} - -// PrepareContext delegates down to the underlying PreparerContext and caches the result -// using the provided query as a key -func (sc *StmtCache) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) { - ctxPrep, ok := sc.prep.(PreparerContext) - if !ok { - return nil, NoContextSupport - } - sc.mu.Lock() - defer sc.mu.Unlock() - stmt, ok := sc.cache[query] - if ok { - return stmt, nil - } - stmt, err := ctxPrep.PrepareContext(ctx, query) - if err == nil { - sc.cache[query] = stmt - } - return stmt, err -} - -// ExecContext delegates down to the underlying PreparerContext using a prepared statement -func (sc *StmtCache) ExecContext(ctx context.Context, query string, args ...interface{}) (res sql.Result, err error) { - stmt, err := sc.PrepareContext(ctx, query) - if err != nil { - return - } - return stmt.ExecContext(ctx, args...) -} - -// QueryContext delegates down to the underlying PreparerContext using a prepared statement -func (sc *StmtCache) QueryContext(ctx context.Context, query string, args ...interface{}) (rows *sql.Rows, err error) { - stmt, err := sc.PrepareContext(ctx, query) - if err != nil { - return - } - return stmt.QueryContext(ctx, args...) -} - -// QueryRowContext delegates down to the underlying PreparerContext using a prepared statement -func (sc *StmtCache) QueryRowContext(ctx context.Context, query string, args ...interface{}) RowScanner { - stmt, err := sc.PrepareContext(ctx, query) - if err != nil { - return &Row{err: err} - } - return stmt.QueryRowContext(ctx, args...) -} diff --git a/vendor/github.com/Masterminds/squirrel/stmtcacher_noctx.go b/vendor/github.com/Masterminds/squirrel/stmtcacher_noctx.go deleted file mode 100644 index deac967..0000000 --- a/vendor/github.com/Masterminds/squirrel/stmtcacher_noctx.go +++ /dev/null @@ -1,21 +0,0 @@ -// +build !go1.8 - -package squirrel - -import ( - "database/sql" -) - -// NewStmtCacher returns a DBProxy wrapping prep that caches Prepared Stmts. -// -// Stmts are cached based on the string value of their queries. -func NewStmtCache(prep Preparer) *StmtCache { - return &StmtCacher{prep: prep, cache: make(map[string]*sql.Stmt)} -} - -// NewStmtCacher is deprecated -// -// Use NewStmtCache instead -func NewStmtCacher(prep Preparer) DBProxy { - return NewStmtCache(prep) -} diff --git a/vendor/github.com/Masterminds/squirrel/update.go b/vendor/github.com/Masterminds/squirrel/update.go deleted file mode 100644 index 8d658d7..0000000 --- a/vendor/github.com/Masterminds/squirrel/update.go +++ /dev/null @@ -1,266 +0,0 @@ -package squirrel - -import ( - "bytes" - "database/sql" - "fmt" - "sort" - "strings" - - "github.com/lann/builder" -) - -type updateData struct { - PlaceholderFormat PlaceholderFormat - RunWith BaseRunner - Prefixes []Sqlizer - Table string - SetClauses []setClause - WhereParts []Sqlizer - OrderBys []string - Limit string - Offset string - Suffixes []Sqlizer -} - -type setClause struct { - column string - value interface{} -} - -func (d *updateData) Exec() (sql.Result, error) { - if d.RunWith == nil { - return nil, RunnerNotSet - } - return ExecWith(d.RunWith, d) -} - -func (d *updateData) Query() (*sql.Rows, error) { - if d.RunWith == nil { - return nil, RunnerNotSet - } - return QueryWith(d.RunWith, d) -} - -func (d *updateData) QueryRow() RowScanner { - if d.RunWith == nil { - return &Row{err: RunnerNotSet} - } - queryRower, ok := d.RunWith.(QueryRower) - if !ok { - return &Row{err: RunnerNotQueryRunner} - } - return QueryRowWith(queryRower, d) -} - -func (d *updateData) ToSql() (sqlStr string, args []interface{}, err error) { - if len(d.Table) == 0 { - err = fmt.Errorf("update statements must specify a table") - return - } - if len(d.SetClauses) == 0 { - err = fmt.Errorf("update statements must have at least one Set clause") - return - } - - sql := &bytes.Buffer{} - - if len(d.Prefixes) > 0 { - args, err = appendToSql(d.Prefixes, sql, " ", args) - if err != nil { - return - } - - sql.WriteString(" ") - } - - sql.WriteString("UPDATE ") - sql.WriteString(d.Table) - - sql.WriteString(" SET ") - setSqls := make([]string, len(d.SetClauses)) - for i, setClause := range d.SetClauses { - var valSql string - if vs, ok := setClause.value.(Sqlizer); ok { - vsql, vargs, err := vs.ToSql() - if err != nil { - return "", nil, err - } - if _, ok := vs.(SelectBuilder); ok { - valSql = fmt.Sprintf("(%s)", vsql) - } else { - valSql = vsql - } - args = append(args, vargs...) - } else { - valSql = "?" - args = append(args, setClause.value) - } - setSqls[i] = fmt.Sprintf("%s = %s", setClause.column, valSql) - } - sql.WriteString(strings.Join(setSqls, ", ")) - - if len(d.WhereParts) > 0 { - sql.WriteString(" WHERE ") - args, err = appendToSql(d.WhereParts, sql, " AND ", args) - if err != nil { - return - } - } - - if len(d.OrderBys) > 0 { - sql.WriteString(" ORDER BY ") - sql.WriteString(strings.Join(d.OrderBys, ", ")) - } - - if len(d.Limit) > 0 { - sql.WriteString(" LIMIT ") - sql.WriteString(d.Limit) - } - - if len(d.Offset) > 0 { - sql.WriteString(" OFFSET ") - sql.WriteString(d.Offset) - } - - if len(d.Suffixes) > 0 { - sql.WriteString(" ") - args, err = appendToSql(d.Suffixes, sql, " ", args) - if err != nil { - return - } - } - - sqlStr, err = d.PlaceholderFormat.ReplacePlaceholders(sql.String()) - return -} - -// Builder - -// UpdateBuilder builds SQL UPDATE statements. -type UpdateBuilder builder.Builder - -func init() { - builder.Register(UpdateBuilder{}, updateData{}) -} - -// Format methods - -// PlaceholderFormat sets PlaceholderFormat (e.g. Question or Dollar) for the -// query. -func (b UpdateBuilder) PlaceholderFormat(f PlaceholderFormat) UpdateBuilder { - return builder.Set(b, "PlaceholderFormat", f).(UpdateBuilder) -} - -// Runner methods - -// RunWith sets a Runner (like database/sql.DB) to be used with e.g. Exec. -func (b UpdateBuilder) RunWith(runner BaseRunner) UpdateBuilder { - return setRunWith(b, runner).(UpdateBuilder) -} - -// Exec builds and Execs the query with the Runner set by RunWith. -func (b UpdateBuilder) Exec() (sql.Result, error) { - data := builder.GetStruct(b).(updateData) - return data.Exec() -} - -func (b UpdateBuilder) Query() (*sql.Rows, error) { - data := builder.GetStruct(b).(updateData) - return data.Query() -} - -func (b UpdateBuilder) QueryRow() RowScanner { - data := builder.GetStruct(b).(updateData) - return data.QueryRow() -} - -func (b UpdateBuilder) Scan(dest ...interface{}) error { - return b.QueryRow().Scan(dest...) -} - -// SQL methods - -// ToSql builds the query into a SQL string and bound args. -func (b UpdateBuilder) ToSql() (string, []interface{}, error) { - data := builder.GetStruct(b).(updateData) - return data.ToSql() -} - -// MustSql builds the query into a SQL string and bound args. -// It panics if there are any errors. -func (b UpdateBuilder) MustSql() (string, []interface{}) { - sql, args, err := b.ToSql() - if err != nil { - panic(err) - } - return sql, args -} - -// Prefix adds an expression to the beginning of the query -func (b UpdateBuilder) Prefix(sql string, args ...interface{}) UpdateBuilder { - return b.PrefixExpr(Expr(sql, args...)) -} - -// PrefixExpr adds an expression to the very beginning of the query -func (b UpdateBuilder) PrefixExpr(expr Sqlizer) UpdateBuilder { - return builder.Append(b, "Prefixes", expr).(UpdateBuilder) -} - -// Table sets the table to be updated. -func (b UpdateBuilder) Table(table string) UpdateBuilder { - return builder.Set(b, "Table", table).(UpdateBuilder) -} - -// Set adds SET clauses to the query. -func (b UpdateBuilder) Set(column string, value interface{}) UpdateBuilder { - return builder.Append(b, "SetClauses", setClause{column: column, value: value}).(UpdateBuilder) -} - -// SetMap is a convenience method which calls .Set for each key/value pair in clauses. -func (b UpdateBuilder) SetMap(clauses map[string]interface{}) UpdateBuilder { - keys := make([]string, len(clauses)) - i := 0 - for key := range clauses { - keys[i] = key - i++ - } - sort.Strings(keys) - for _, key := range keys { - val, _ := clauses[key] - b = b.Set(key, val) - } - return b -} - -// Where adds WHERE expressions to the query. -// -// See SelectBuilder.Where for more information. -func (b UpdateBuilder) Where(pred interface{}, args ...interface{}) UpdateBuilder { - return builder.Append(b, "WhereParts", newWherePart(pred, args...)).(UpdateBuilder) -} - -// OrderBy adds ORDER BY expressions to the query. -func (b UpdateBuilder) OrderBy(orderBys ...string) UpdateBuilder { - return builder.Extend(b, "OrderBys", orderBys).(UpdateBuilder) -} - -// Limit sets a LIMIT clause on the query. -func (b UpdateBuilder) Limit(limit uint64) UpdateBuilder { - return builder.Set(b, "Limit", fmt.Sprintf("%d", limit)).(UpdateBuilder) -} - -// Offset sets a OFFSET clause on the query. -func (b UpdateBuilder) Offset(offset uint64) UpdateBuilder { - return builder.Set(b, "Offset", fmt.Sprintf("%d", offset)).(UpdateBuilder) -} - -// Suffix adds an expression to the end of the query -func (b UpdateBuilder) Suffix(sql string, args ...interface{}) UpdateBuilder { - return b.SuffixExpr(Expr(sql, args...)) -} - -// SuffixExpr adds an expression to the end of the query -func (b UpdateBuilder) SuffixExpr(expr Sqlizer) UpdateBuilder { - return builder.Append(b, "Suffixes", expr).(UpdateBuilder) -} diff --git a/vendor/github.com/Masterminds/squirrel/update_ctx.go b/vendor/github.com/Masterminds/squirrel/update_ctx.go deleted file mode 100644 index ad479f9..0000000 --- a/vendor/github.com/Masterminds/squirrel/update_ctx.go +++ /dev/null @@ -1,69 +0,0 @@ -// +build go1.8 - -package squirrel - -import ( - "context" - "database/sql" - - "github.com/lann/builder" -) - -func (d *updateData) ExecContext(ctx context.Context) (sql.Result, error) { - if d.RunWith == nil { - return nil, RunnerNotSet - } - ctxRunner, ok := d.RunWith.(ExecerContext) - if !ok { - return nil, NoContextSupport - } - return ExecContextWith(ctx, ctxRunner, d) -} - -func (d *updateData) QueryContext(ctx context.Context) (*sql.Rows, error) { - if d.RunWith == nil { - return nil, RunnerNotSet - } - ctxRunner, ok := d.RunWith.(QueryerContext) - if !ok { - return nil, NoContextSupport - } - return QueryContextWith(ctx, ctxRunner, d) -} - -func (d *updateData) QueryRowContext(ctx context.Context) RowScanner { - if d.RunWith == nil { - return &Row{err: RunnerNotSet} - } - queryRower, ok := d.RunWith.(QueryRowerContext) - if !ok { - if _, ok := d.RunWith.(QueryerContext); !ok { - return &Row{err: RunnerNotQueryRunner} - } - return &Row{err: NoContextSupport} - } - return QueryRowContextWith(ctx, queryRower, d) -} - -// ExecContext builds and ExecContexts the query with the Runner set by RunWith. -func (b UpdateBuilder) ExecContext(ctx context.Context) (sql.Result, error) { - data := builder.GetStruct(b).(updateData) - return data.ExecContext(ctx) -} - -// QueryContext builds and QueryContexts the query with the Runner set by RunWith. -func (b UpdateBuilder) QueryContext(ctx context.Context) (*sql.Rows, error) { - data := builder.GetStruct(b).(updateData) - return data.QueryContext(ctx) -} - -// QueryRowContext builds and QueryRowContexts the query with the Runner set by RunWith. -func (b UpdateBuilder) QueryRowContext(ctx context.Context) RowScanner { - data := builder.GetStruct(b).(updateData) - return data.QueryRowContext(ctx) -} - -// ScanContext is a shortcut for QueryRowContext().Scan. -func (b UpdateBuilder) ScanContext(ctx context.Context, dest ...interface{}) error { - return b.QueryRowContext(ctx).Scan(dest...) -} diff --git a/vendor/github.com/Masterminds/squirrel/where.go b/vendor/github.com/Masterminds/squirrel/where.go deleted file mode 100644 index 976b63a..0000000 --- a/vendor/github.com/Masterminds/squirrel/where.go +++ /dev/null @@ -1,30 +0,0 @@ -package squirrel - -import ( - "fmt" -) - -type wherePart part - -func newWherePart(pred interface{}, args ...interface{}) Sqlizer { - return &wherePart{pred: pred, args: args} -} - -func (p wherePart) ToSql() (sql string, args []interface{}, err error) { - switch pred := p.pred.(type) { - case nil: - // no-op - case rawSqlizer: - return pred.toSqlRaw() - case Sqlizer: - return pred.ToSql() - case map[string]interface{}: - return Eq(pred).ToSql() - case string: - sql = pred - args = p.args - default: - err = fmt.Errorf("expected string-keyed map or string, not %T", pred) - } - return -} diff --git a/vendor/github.com/armon/go-radix/.gitignore b/vendor/github.com/armon/go-radix/.gitignore deleted file mode 100644 index 0026861..0000000 --- a/vendor/github.com/armon/go-radix/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe diff --git a/vendor/github.com/armon/go-radix/.travis.yml b/vendor/github.com/armon/go-radix/.travis.yml deleted file mode 100644 index 1a0bbea..0000000 --- a/vendor/github.com/armon/go-radix/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: go -go: - - tip diff --git a/vendor/github.com/armon/go-radix/LICENSE b/vendor/github.com/armon/go-radix/LICENSE deleted file mode 100644 index a5df10e..0000000 --- a/vendor/github.com/armon/go-radix/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Armon Dadgar - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/armon/go-radix/README.md b/vendor/github.com/armon/go-radix/README.md deleted file mode 100644 index 26f42a2..0000000 --- a/vendor/github.com/armon/go-radix/README.md +++ /dev/null @@ -1,38 +0,0 @@ -go-radix [![Build Status](https://travis-ci.org/armon/go-radix.png)](https://travis-ci.org/armon/go-radix) -========= - -Provides the `radix` package that implements a [radix tree](http://en.wikipedia.org/wiki/Radix_tree). -The package only provides a single `Tree` implementation, optimized for sparse nodes. - -As a radix tree, it provides the following: - * O(k) operations. In many cases, this can be faster than a hash table since - the hash function is an O(k) operation, and hash tables have very poor cache locality. - * Minimum / Maximum value lookups - * Ordered iteration - -For an immutable variant, see [go-immutable-radix](https://github.com/hashicorp/go-immutable-radix). - -Documentation -============= - -The full documentation is available on [Godoc](http://godoc.org/github.com/armon/go-radix). - -Example -======= - -Below is a simple example of usage - -```go -// Create a tree -r := radix.New() -r.Insert("foo", 1) -r.Insert("bar", 2) -r.Insert("foobar", 2) - -// Find the longest prefix match -m, _, _ := r.LongestPrefix("foozip") -if m != "foo" { - panic("should be foo") -} -``` - diff --git a/vendor/github.com/armon/go-radix/radix.go b/vendor/github.com/armon/go-radix/radix.go deleted file mode 100644 index e2bb22e..0000000 --- a/vendor/github.com/armon/go-radix/radix.go +++ /dev/null @@ -1,540 +0,0 @@ -package radix - -import ( - "sort" - "strings" -) - -// WalkFn is used when walking the tree. Takes a -// key and value, returning if iteration should -// be terminated. -type WalkFn func(s string, v interface{}) bool - -// leafNode is used to represent a value -type leafNode struct { - key string - val interface{} -} - -// edge is used to represent an edge node -type edge struct { - label byte - node *node -} - -type node struct { - // leaf is used to store possible leaf - leaf *leafNode - - // prefix is the common prefix we ignore - prefix string - - // Edges should be stored in-order for iteration. - // We avoid a fully materialized slice to save memory, - // since in most cases we expect to be sparse - edges edges -} - -func (n *node) isLeaf() bool { - return n.leaf != nil -} - -func (n *node) addEdge(e edge) { - n.edges = append(n.edges, e) - n.edges.Sort() -} - -func (n *node) updateEdge(label byte, node *node) { - num := len(n.edges) - idx := sort.Search(num, func(i int) bool { - return n.edges[i].label >= label - }) - if idx < num && n.edges[idx].label == label { - n.edges[idx].node = node - return - } - panic("replacing missing edge") -} - -func (n *node) getEdge(label byte) *node { - num := len(n.edges) - idx := sort.Search(num, func(i int) bool { - return n.edges[i].label >= label - }) - if idx < num && n.edges[idx].label == label { - return n.edges[idx].node - } - return nil -} - -func (n *node) delEdge(label byte) { - num := len(n.edges) - idx := sort.Search(num, func(i int) bool { - return n.edges[i].label >= label - }) - if idx < num && n.edges[idx].label == label { - copy(n.edges[idx:], n.edges[idx+1:]) - n.edges[len(n.edges)-1] = edge{} - n.edges = n.edges[:len(n.edges)-1] - } -} - -type edges []edge - -func (e edges) Len() int { - return len(e) -} - -func (e edges) Less(i, j int) bool { - return e[i].label < e[j].label -} - -func (e edges) Swap(i, j int) { - e[i], e[j] = e[j], e[i] -} - -func (e edges) Sort() { - sort.Sort(e) -} - -// Tree implements a radix tree. This can be treated as a -// Dictionary abstract data type. The main advantage over -// a standard hash map is prefix-based lookups and -// ordered iteration, -type Tree struct { - root *node - size int -} - -// New returns an empty Tree -func New() *Tree { - return NewFromMap(nil) -} - -// NewFromMap returns a new tree containing the keys -// from an existing map -func NewFromMap(m map[string]interface{}) *Tree { - t := &Tree{root: &node{}} - for k, v := range m { - t.Insert(k, v) - } - return t -} - -// Len is used to return the number of elements in the tree -func (t *Tree) Len() int { - return t.size -} - -// longestPrefix finds the length of the shared prefix -// of two strings -func longestPrefix(k1, k2 string) int { - max := len(k1) - if l := len(k2); l < max { - max = l - } - var i int - for i = 0; i < max; i++ { - if k1[i] != k2[i] { - break - } - } - return i -} - -// Insert is used to add a newentry or update -// an existing entry. Returns if updated. -func (t *Tree) Insert(s string, v interface{}) (interface{}, bool) { - var parent *node - n := t.root - search := s - for { - // Handle key exhaution - if len(search) == 0 { - if n.isLeaf() { - old := n.leaf.val - n.leaf.val = v - return old, true - } - - n.leaf = &leafNode{ - key: s, - val: v, - } - t.size++ - return nil, false - } - - // Look for the edge - parent = n - n = n.getEdge(search[0]) - - // No edge, create one - if n == nil { - e := edge{ - label: search[0], - node: &node{ - leaf: &leafNode{ - key: s, - val: v, - }, - prefix: search, - }, - } - parent.addEdge(e) - t.size++ - return nil, false - } - - // Determine longest prefix of the search key on match - commonPrefix := longestPrefix(search, n.prefix) - if commonPrefix == len(n.prefix) { - search = search[commonPrefix:] - continue - } - - // Split the node - t.size++ - child := &node{ - prefix: search[:commonPrefix], - } - parent.updateEdge(search[0], child) - - // Restore the existing node - child.addEdge(edge{ - label: n.prefix[commonPrefix], - node: n, - }) - n.prefix = n.prefix[commonPrefix:] - - // Create a new leaf node - leaf := &leafNode{ - key: s, - val: v, - } - - // If the new key is a subset, add to to this node - search = search[commonPrefix:] - if len(search) == 0 { - child.leaf = leaf - return nil, false - } - - // Create a new edge for the node - child.addEdge(edge{ - label: search[0], - node: &node{ - leaf: leaf, - prefix: search, - }, - }) - return nil, false - } -} - -// Delete is used to delete a key, returning the previous -// value and if it was deleted -func (t *Tree) Delete(s string) (interface{}, bool) { - var parent *node - var label byte - n := t.root - search := s - for { - // Check for key exhaution - if len(search) == 0 { - if !n.isLeaf() { - break - } - goto DELETE - } - - // Look for an edge - parent = n - label = search[0] - n = n.getEdge(label) - if n == nil { - break - } - - // Consume the search prefix - if strings.HasPrefix(search, n.prefix) { - search = search[len(n.prefix):] - } else { - break - } - } - return nil, false - -DELETE: - // Delete the leaf - leaf := n.leaf - n.leaf = nil - t.size-- - - // Check if we should delete this node from the parent - if parent != nil && len(n.edges) == 0 { - parent.delEdge(label) - } - - // Check if we should merge this node - if n != t.root && len(n.edges) == 1 { - n.mergeChild() - } - - // Check if we should merge the parent's other child - if parent != nil && parent != t.root && len(parent.edges) == 1 && !parent.isLeaf() { - parent.mergeChild() - } - - return leaf.val, true -} - -// DeletePrefix is used to delete the subtree under a prefix -// Returns how many nodes were deleted -// Use this to delete large subtrees efficiently -func (t *Tree) DeletePrefix(s string) int { - return t.deletePrefix(nil, t.root, s) -} - -// delete does a recursive deletion -func (t *Tree) deletePrefix(parent, n *node, prefix string) int { - // Check for key exhaustion - if len(prefix) == 0 { - // Remove the leaf node - subTreeSize := 0 - //recursively walk from all edges of the node to be deleted - recursiveWalk(n, func(s string, v interface{}) bool { - subTreeSize++ - return false - }) - if n.isLeaf() { - n.leaf = nil - } - n.edges = nil // deletes the entire subtree - - // Check if we should merge the parent's other child - if parent != nil && parent != t.root && len(parent.edges) == 1 && !parent.isLeaf() { - parent.mergeChild() - } - t.size -= subTreeSize - return subTreeSize - } - - // Look for an edge - label := prefix[0] - child := n.getEdge(label) - if child == nil || (!strings.HasPrefix(child.prefix, prefix) && !strings.HasPrefix(prefix, child.prefix)) { - return 0 - } - - // Consume the search prefix - if len(child.prefix) > len(prefix) { - prefix = prefix[len(prefix):] - } else { - prefix = prefix[len(child.prefix):] - } - return t.deletePrefix(n, child, prefix) -} - -func (n *node) mergeChild() { - e := n.edges[0] - child := e.node - n.prefix = n.prefix + child.prefix - n.leaf = child.leaf - n.edges = child.edges -} - -// Get is used to lookup a specific key, returning -// the value and if it was found -func (t *Tree) Get(s string) (interface{}, bool) { - n := t.root - search := s - for { - // Check for key exhaution - if len(search) == 0 { - if n.isLeaf() { - return n.leaf.val, true - } - break - } - - // Look for an edge - n = n.getEdge(search[0]) - if n == nil { - break - } - - // Consume the search prefix - if strings.HasPrefix(search, n.prefix) { - search = search[len(n.prefix):] - } else { - break - } - } - return nil, false -} - -// LongestPrefix is like Get, but instead of an -// exact match, it will return the longest prefix match. -func (t *Tree) LongestPrefix(s string) (string, interface{}, bool) { - var last *leafNode - n := t.root - search := s - for { - // Look for a leaf node - if n.isLeaf() { - last = n.leaf - } - - // Check for key exhaution - if len(search) == 0 { - break - } - - // Look for an edge - n = n.getEdge(search[0]) - if n == nil { - break - } - - // Consume the search prefix - if strings.HasPrefix(search, n.prefix) { - search = search[len(n.prefix):] - } else { - break - } - } - if last != nil { - return last.key, last.val, true - } - return "", nil, false -} - -// Minimum is used to return the minimum value in the tree -func (t *Tree) Minimum() (string, interface{}, bool) { - n := t.root - for { - if n.isLeaf() { - return n.leaf.key, n.leaf.val, true - } - if len(n.edges) > 0 { - n = n.edges[0].node - } else { - break - } - } - return "", nil, false -} - -// Maximum is used to return the maximum value in the tree -func (t *Tree) Maximum() (string, interface{}, bool) { - n := t.root - for { - if num := len(n.edges); num > 0 { - n = n.edges[num-1].node - continue - } - if n.isLeaf() { - return n.leaf.key, n.leaf.val, true - } - break - } - return "", nil, false -} - -// Walk is used to walk the tree -func (t *Tree) Walk(fn WalkFn) { - recursiveWalk(t.root, fn) -} - -// WalkPrefix is used to walk the tree under a prefix -func (t *Tree) WalkPrefix(prefix string, fn WalkFn) { - n := t.root - search := prefix - for { - // Check for key exhaution - if len(search) == 0 { - recursiveWalk(n, fn) - return - } - - // Look for an edge - n = n.getEdge(search[0]) - if n == nil { - break - } - - // Consume the search prefix - if strings.HasPrefix(search, n.prefix) { - search = search[len(n.prefix):] - - } else if strings.HasPrefix(n.prefix, search) { - // Child may be under our search prefix - recursiveWalk(n, fn) - return - } else { - break - } - } - -} - -// WalkPath is used to walk the tree, but only visiting nodes -// from the root down to a given leaf. Where WalkPrefix walks -// all the entries *under* the given prefix, this walks the -// entries *above* the given prefix. -func (t *Tree) WalkPath(path string, fn WalkFn) { - n := t.root - search := path - for { - // Visit the leaf values if any - if n.leaf != nil && fn(n.leaf.key, n.leaf.val) { - return - } - - // Check for key exhaution - if len(search) == 0 { - return - } - - // Look for an edge - n = n.getEdge(search[0]) - if n == nil { - return - } - - // Consume the search prefix - if strings.HasPrefix(search, n.prefix) { - search = search[len(n.prefix):] - } else { - break - } - } -} - -// recursiveWalk is used to do a pre-order walk of a node -// recursively. Returns true if the walk should be aborted -func recursiveWalk(n *node, fn WalkFn) bool { - // Visit the leaf values if any - if n.leaf != nil && fn(n.leaf.key, n.leaf.val) { - return true - } - - // Recurse on the children - for _, e := range n.edges { - if recursiveWalk(e.node, fn) { - return true - } - } - return false -} - -// ToMap is used to walk the tree and convert it into a map -func (t *Tree) ToMap() map[string]interface{} { - out := make(map[string]interface{}, t.size) - t.Walk(func(k string, v interface{}) bool { - out[k] = v - return false - }) - return out -} diff --git a/vendor/github.com/bnkamalesh/errors/.gitignore b/vendor/github.com/bnkamalesh/errors/.gitignore deleted file mode 100644 index 15d1c11..0000000 --- a/vendor/github.com/bnkamalesh/errors/.gitignore +++ /dev/null @@ -1,107 +0,0 @@ - -# Created by https://www.toptal.com/developers/gitignore/api/go,visualstudiocode,osx,linux,windows -# Edit at https://www.toptal.com/developers/gitignore?templates=go,visualstudiocode,osx,linux,windows - -### Go ### -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, built with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Dependency directories (remove the comment below to include it) -# vendor/ - -### Go Patch ### -/vendor/ -/Godeps/ - -### Linux ### -*~ - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* - -# .nfs files are created when an open file is removed but is still being accessed -.nfs* - -### OSX ### -# General -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -### VisualStudioCode ### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -*.code-workspace - -### VisualStudioCode Patch ### -# Ignore all local history of files -.history - -### Windows ### -# Windows thumbnail cache files -Thumbs.db -Thumbs.db:encryptable -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# End of https://www.toptal.com/developers/gitignore/api/go,visualstudiocode,osx,linux,windows diff --git a/vendor/github.com/bnkamalesh/errors/.travis.yml b/vendor/github.com/bnkamalesh/errors/.travis.yml deleted file mode 100644 index 1476211..0000000 --- a/vendor/github.com/bnkamalesh/errors/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: go -go: - - master - -script: - - go test -mod=vendor -coverprofile=coverage.txt -covermode=atomic $(go list ./... | grep -v /cmd) - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/bnkamalesh/errors/LICENSE b/vendor/github.com/bnkamalesh/errors/LICENSE deleted file mode 100644 index ac6e3d1..0000000 --- a/vendor/github.com/bnkamalesh/errors/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 Kamaleshwar - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/bnkamalesh/errors/README.md b/vendor/github.com/bnkamalesh/errors/README.md deleted file mode 100644 index cbf67cc..0000000 --- a/vendor/github.com/bnkamalesh/errors/README.md +++ /dev/null @@ -1,254 +0,0 @@ -

errors gopher

- -[![Build Status](https://travis-ci.org/bnkamalesh/errors.svg?branch=master)](https://travis-ci.org/bnkamalesh/errors) -[![codecov](https://codecov.io/gh/bnkamalesh/errors/branch/master/graph/badge.svg)](https://codecov.io/gh/bnkamalesh/errors) -[![Go Report Card](https://goreportcard.com/badge/github.com/bnkamalesh/errors)](https://goreportcard.com/report/github.com/bnkamalesh/errors) -[![Maintainability](https://api.codeclimate.com/v1/badges/a86629ab167695d4db7f/maintainability)](https://codeclimate.com/github/bnkamalesh/errors) -[![](https://godoc.org/github.com/nathany/looper?status.svg)](https://pkg.go.dev/github.com/bnkamalesh/errors?tab=doc) -[![](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go#error-handling) - -# Errors v0.9.4 - -Errors package is a drop-in replacement of the built-in Go errors package. It lets you create errors of 11 different types, -which should handle most of the use cases. Some of them are a bit too specific for web applications, but useful nonetheless. - -Features of this package: - -1. Multiple (11) error types -2. Easy handling of User friendly message(s) -3. Stacktrace - formatted, unfromatted, custom format (refer tests in errors_test.go) -4. Retrieve the Program Counters for the stacktrace -5. Retrieve runtime.Frames using `errors.RuntimeFrames(err error)` for the stacktrace -6. HTTP status code and user friendly message (wrapped messages are concatenated) for all error types -7. Helper functions to generate each error type -8. Helper function to get error Type, error type as int, check if error type is wrapped anywhere in chain -9. `fmt.Formatter` support - -In case of nested errors, the messages & errors are also looped through the full chain of errors. - -### Prerequisites - -Go 1.13+ - -### Available error types - -1. TypeInternal - For internal system error. e.g. Database errors -2. TypeValidation - For validation error. e.g. invalid email address -3. TypeInputBody - For invalid input data. e.g. invalid JSON -4. TypeDuplicate - For duplicate content error. e.g. user with email already exists (when trying to register a new user) -5. TypeUnauthenticated - For not authenticated error -6. TypeUnauthorized - For unauthorized access error -7. TypeEmpty - For when an expected non-empty resource, is empty -8. TypeNotFound - For expected resource not found. e.g. user ID not found -9. TypeMaximumAttempts - For attempting the same action more than an allowed threshold -10. TypeSubscriptionExpired - For when a user's 'paid' account has expired -11. TypeDownstreamDependencyTimedout - For when a request to a downstream dependent service times out - -Helper functions are available for all the error types. Each of them have 2 helper functions, one which accepts only a string, -and the other which accepts an original error as well as a user friendly message. - -All the dedicated error type functions are documented [here](https://pkg.go.dev/github.com/bnkamalesh/errors?tab=doc#DownstreamDependencyTimedout). -Names are consistent with the error type, e.g. errors.Internal(string) and errors.InternalErr(error, string) - -### User friendly messages - -More often than not when writing APIs, we'd want to respond with an easier to undersand user friendly message. -Instead of returning the raw error and log the raw error. - -There are helper functions for all the error types. When in need of setting a friendly message, there -are helper functions with the _suffix_ **'Err'**. All such helper functions accept the original error and a string. - -```golang -package main - -import ( - "fmt" - - "github.com/bnkamalesh/errors" -) - -func Bar() error { - return fmt.Errorf("hello %s", "world!") -} - -func Foo() error { - err := Bar() - if err != nil { - return errors.InternalErr(err, "bar is not happy") - } - return nil -} - -func main() { - err := Foo() - - fmt.Println("err:", err) - fmt.Println("\nerr.Error():", err.Error()) - - fmt.Printf("\nformatted +v: %+v\n", err) - fmt.Printf("\nformatted v: %v\n", err) - fmt.Printf("\nformatted +s: %+s\n", err) - fmt.Printf("\nformatted s: %s\n", err) - - _, msg, _ := errors.HTTPStatusCodeMessage(err) - fmt.Println("\nmsg:", msg) -} -``` - -Output - -``` -err: bar is not happy - -err.Error(): /Users/k.balakumaran/go/src/github.com/bnkamalesh/errors/cmd/main.go:16: bar is not happy -hello world!bar is not happy - -formatted +v: /Users/k.balakumaran/go/src/github.com/bnkamalesh/errors/cmd/main.go:16: bar is not happy -hello world!bar is not happy - -formatted v: bar is not happy - -formatted +s: bar is not happy: hello world! - -formatted s: bar is not happy - -msg: bar is not happy -``` - -[Playground link](https://go.dev/play/p/-WzDH46f_U5) - -### File & line number prefixed to errors - -A common annoyance with Go errors which most people are aware of is, figuring out the origin of the error, especially when there are nested function calls. Ever since error annotation was introduced in Go, a lot of people have tried using it to trace out an errors origin by giving function names, contextual message etc in it. e.g. `fmt.Errorf("database query returned error %w", err)`. However this errors package, whenever you call the Go error interface's `Error() string` function, prints the error prefixed by the filepath and line number. It'd look like `../Users/JohnDoe/apps/main.go:50 hello world` where 'hello world' is the error message. - -### HTTP status code & message - -The function `errors.HTTPStatusCodeMessage(error) (int, string, bool)` returns the HTTP status code, message, and a boolean value. The boolean is true, if the error is of type \*Error from this package. If error is nested, it unwraps and returns a single concatenated message. Sample described in the 'How to use?' section - -## How to use? - -A sample was already shown in the user friendly message section, following one would show a few more scenarios. - -```golang -package main - -import ( - "fmt" - "net/http" - "time" - - "github.com/bnkamalesh/errors" - "github.com/bnkamalesh/webgo/v6" - "github.com/bnkamalesh/webgo/v6/middleware/accesslog" -) - -func bar() error { - return fmt.Errorf("%s %s", "sinking", "bar") -} - -func bar2() error { - err := bar() - if err != nil { - return errors.InternalErr(err, "bar2 was deceived by bar1 :(") - } - return nil -} - -func foo() error { - err := bar2() - if err != nil { - return errors.InternalErr(err, "we lost bar2!") - } - return nil -} - -func handler(w http.ResponseWriter, r *http.Request) { - err := foo() - if err != nil { - // log the error on your server for troubleshooting - fmt.Println(err.Error()) - // respond to request with friendly msg - status, msg, _ := errors.HTTPStatusCodeMessage(err) - webgo.SendError(w, msg, status) - return - } - - webgo.R200(w, "yay!") -} - -func routes() []*webgo.Route { - return []*webgo.Route{ - { - Name: "home", - Method: http.MethodGet, - Pattern: "/", - Handlers: []http.HandlerFunc{ - handler, - }, - }, - } -} - -func main() { - router := webgo.NewRouter(&webgo.Config{ - Host: "", - Port: "8080", - ReadTimeout: 15 * time.Second, - WriteTimeout: 60 * time.Second, - }, routes()...) - - router.UseOnSpecialHandlers(accesslog.AccessLog) - router.Use(accesslog.AccessLog) - router.Start() -} -``` - -[webgo](https://github.com/bnkamalesh/webgo) was used to illustrate the usage of the function, `errors.HTTPStatusCodeMessage`. It returns the appropriate http status code, user friendly message stored within, and a boolean value. Boolean value is `true` if the returned error of type \*Error. -Since we get the status code and message separately, when using any web framework, you can set values according to the respective framework's native functions. In case of Webgo, it wraps errors in a struct of its own. Otherwise, you could directly respond to the HTTP request by calling `errors.WriteHTTP(error,http.ResponseWriter)`. - -Once the app is running, you can check the response by opening `http://localhost:8080` on your browser. Or on terminal - -```bash -$ curl http://localhost:8080 -{"errors":"we lost bar2!. bar2 was deceived by bar1 :(","status":500} // output -``` - -And the `fmt.Println(err.Error())` generated output on stdout would be: - -```bash -/Users/username/go/src/errorscheck/main.go:28 /Users/username/go/src/errorscheck/main.go:20 sinking bar -``` - -## Benchmark [2022-01-12] - -MacBook Pro (13-inch, 2020, Four Thunderbolt 3 ports), 32 GB 3733 MHz LPDDR4X - -```bash -$ go version -go version go1.19.5 darwin/amd64 - -$ go test -benchmem -bench . -goos: darwin -goarch: amd64 -pkg: github.com/bnkamalesh/errors -cpu: Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz -Benchmark_Internal-8 1526194 748.8 ns/op 1104 B/op 2 allocs/op -Benchmark_Internalf-8 1281465 944.0 ns/op 1128 B/op 3 allocs/op -Benchmark_InternalErr-8 1494351 806.7 ns/op 1104 B/op 2 allocs/op -Benchmark_InternalGetError-8 981162 1189 ns/op 1528 B/op 6 allocs/op -Benchmark_InternalGetErrorWithNestedError-8 896322 1267 ns/op 1544 B/op 6 allocs/op -Benchmark_InternalGetMessage-8 1492812 804.2 ns/op 1104 B/op 2 allocs/op -Benchmark_InternalGetMessageWithNestedError-8 1362092 886.3 ns/op 1128 B/op 3 allocs/op -Benchmark_HTTPStatusCodeMessage-8 27494096 41.38 ns/op 16 B/op 1 allocs/op -BenchmarkHasType-8 100000000 10.50 ns/op 0 B/op 0 allocs/op -PASS -ok github.com/bnkamalesh/errors 15.006s -``` - -## Contributing - -More error types, customization, features, multi-errors; PRs & issues are welcome! - -## The gopher - -The gopher used here was created using [Gopherize.me](https://gopherize.me/). Show some love to Go errors like our gopher lady here! diff --git a/vendor/github.com/bnkamalesh/errors/errors.go b/vendor/github.com/bnkamalesh/errors/errors.go deleted file mode 100644 index 4a7327c..0000000 --- a/vendor/github.com/bnkamalesh/errors/errors.go +++ /dev/null @@ -1,528 +0,0 @@ -// Package errors helps in wrapping errors with custom type as well as a user friendly message. This is particularly useful when responding to APIs -package errors - -import ( - "bytes" - "fmt" - "io" - "net/http" - "runtime" - "strconv" - "strings" -) - -type errType int - -func (e errType) Int() int { - return int(e) -} - -// While adding a new Type, the respective helper functions should be added, also update the -// WriteHTTP method accordingly -const ( - // TypeInternal is error type for when there is an internal system error. e.g. Database errors - TypeInternal errType = iota - // TypeValidation is error type for when there is a validation error. e.g. invalid email address - TypeValidation - // TypeInputBody is error type for when an input data type error. e.g. invalid JSON - TypeInputBody - // TypeDuplicate is error type for when there's duplicate content - TypeDuplicate - // TypeUnauthenticated is error type when trying to access an authenticated API without authentication - TypeUnauthenticated - // TypeUnauthorized is error type for when there's an unauthorized access attempt - TypeUnauthorized - // TypeEmpty is error type for when an expected non-empty resource, is empty - TypeEmpty - // TypeNotFound is error type for an expected resource is not found e.g. user ID not found - TypeNotFound - // TypeMaximumAttempts is error type for attempting the same action more than allowed - TypeMaximumAttempts - // TypeSubscriptionExpired is error type for when a user's 'paid' account has expired - TypeSubscriptionExpired - // TypeDownstreamDependencyTimedout is error type for when a request to a downstream dependent service times out - TypeDownstreamDependencyTimedout - - // DefaultMessage is the default user friendly message - DefaultMessage = "unknown error occurred" -) - -var ( - defaultErrType = TypeInternal -) - -// Error is the struct which holds custom attributes -type Error struct { - // original is the original error - original error - // Message is meant to be returned as response of API, so this should be a user-friendly message - message string - // Type is used to define the type of the error, e.g. Server error, validation error etc. - eType errType - pcs []uintptr - pc uintptr -} - -func (e *Error) fileLine() string { - if e.pc == 0 { - return "" - } - - frames := runtime.CallersFrames([]uintptr{e.pc + 1}) - frame, _ := frames.Next() - - buff := bytes.NewBuffer(make([]byte, 0, 128)) - buff.WriteString(frame.File) - buff.WriteString(":") - buff.WriteString(strconv.Itoa(frame.Line)) - - return buff.String() -} - -// Error is the implementation of error interface -func (e *Error) Error() string { - str := bytes.NewBuffer(make([]byte, 0, 128)) - str.WriteString(e.fileLine()) - if str.Len() != 0 { - str.WriteString(": ") - } - - if e.original != nil { - str.WriteString(e.message) - str.WriteString("\n") - str.WriteString(e.original.Error()) - return str.String() - } - - if e.message != "" { - str.WriteString(e.message) - return str.String() - } - - str.WriteString(DefaultMessage) - - return str.String() -} - -// ErrorWithoutFileLine prints the final string without the stack trace / file+line number -func (e *Error) ErrorWithoutFileLine() string { - if e.original != nil { - if e.message != "" { - msg := bytes.NewBuffer(make([]byte, 0, 128)) - msg.WriteString(e.message) - msg.WriteString(": ") - if o, ok := e.original.(*Error); ok { - msg.WriteString(o.ErrorWithoutFileLine()) - } else { - msg.WriteString(e.original.Error()) - } - return msg.String() - } - return e.original.Error() - } - - if e.message != "" { - return e.message - } - - return e.fileLine() -} - -// Message returns the user friendly message stored in the error struct. It will ignore all errors -// which are not of type *Error -func (e *Error) Message() string { - messages := make([]string, 0, 5) - if e.message != "" { - messages = append(messages, e.message) - } - - err, _ := e.original.(*Error) - for err != nil { - if err.message == "" { - err, _ = err.original.(*Error) - continue - } - messages = append(messages, err.message) - err, _ = err.original.(*Error) - } - - if len(messages) > 0 { - return strings.Join(messages, ": ") - } - - return e.Error() -} - -// Unwrap implement's Go 1.13's Unwrap interface exposing the wrapped error -func (e *Error) Unwrap() error { - return e.original -} - -// Is implements the Is interface required by Go -func (e *Error) Is(err error) bool { - o, _ := err.(*Error) - return o == e -} - -// HTTPStatusCode is a convenience method used to get the appropriate HTTP response status code for the respective error type -func (e *Error) HTTPStatusCode() int { - status := http.StatusInternalServerError - switch e.eType { - case TypeValidation: - { - status = http.StatusUnprocessableEntity - } - case TypeInputBody: - { - status = http.StatusBadRequest - } - - case TypeDuplicate: - { - status = http.StatusConflict - } - - case TypeUnauthenticated: - { - status = http.StatusUnauthorized - } - case TypeUnauthorized: - { - status = http.StatusForbidden - } - - case TypeEmpty: - { - status = http.StatusGone - } - - case TypeNotFound: - { - status = http.StatusNotFound - - } - case TypeMaximumAttempts: - { - status = http.StatusTooManyRequests - } - case TypeSubscriptionExpired: - { - status = http.StatusPaymentRequired - } - } - - return status -} - -// Type returns the error type as integer -func (e *Error) Type() errType { - return e.eType -} - -// Format implements the verbs/directives supported by Error to be used in fmt annotated/formatted strings -/* -%v - the same output as Message(). i.e. recursively get all the custom messages set by user - - if any of the wrapped error is not of type *Error, that will *not* be displayed -%+v - recursively prints all the messages along with the file & line number. Also includes output of `Error()` of -non *Error types. - -%s - identical to %v -%+s - recursively prints all the messages without file & line number. Also includes output `Error()` of -non *Error types. -*/ -func (e *Error) Format(s fmt.State, verb rune) { - switch verb { - case 'v': - if s.Flag('+') { - _, _ = io.WriteString(s, e.Error()) - } else { - _, _ = io.WriteString(s, e.Message()) - } - case 's': - { - if s.Flag('+') { - _, _ = io.WriteString(s, e.ErrorWithoutFileLine()) - } else { - _, _ = io.WriteString(s, e.Message()) - } - } - } -} - -func (e *Error) RuntimeFrames() *runtime.Frames { - return runtime.CallersFrames(e.ProgramCounters()) -} - -func (e *Error) ProgramCounters() []uintptr { - return e.pcs -} - -func (e *Error) StackTrace() []string { - rframes := e.RuntimeFrames() - frame, ok := rframes.Next() - buff := bytes.NewBuffer(make([]byte, 0, 128)) - buff.WriteString(frame.Function) - buff.WriteString("(): ") - buff.WriteString(e.message) - - trace := make([]string, 0, len(e.ProgramCounters())) - trace = append(trace, buff.String()) - for ok { - buff.Reset() - buff.WriteString("\t") - buff.WriteString(frame.File) - buff.WriteString(":") - buff.WriteString(strconv.Itoa(frame.Line)) - trace = append(trace, buff.String()) - frame, ok = rframes.Next() - } - return trace -} - -func (e *Error) StackTraceNoFormat() []string { - rframes := e.RuntimeFrames() - frame, ok := rframes.Next() - line := strconv.Itoa(frame.Line) - - buff := bytes.NewBuffer(make([]byte, 0, 128)) - buff.WriteString(frame.Function) - buff.WriteString("(): ") - buff.WriteString(e.message) - - trace := make([]string, 0, len(e.ProgramCounters())) - trace = append(trace, buff.String()) - for ok { - buff.Reset() - buff.WriteString(frame.File) - buff.WriteString(":") - buff.WriteString(line) - trace = append(trace, buff.String()) - frame, ok = rframes.Next() - } - return trace -} - -// StackTraceCustomFormat lets you prepare a stacktrace in a custom format -/* -Supported directives: -%m - message -%p - file path -%l - line -%f - function -*/ -func (e *Error) StackTraceCustomFormat(msgformat string, traceFormat string) []string { - rframes := e.RuntimeFrames() - frame, ok := rframes.Next() - - message := strings.ReplaceAll(msgformat, "%m", e.message) - message = strings.ReplaceAll(message, "%p", frame.File) - message = strings.ReplaceAll(message, "%l", strconv.Itoa(frame.Line)) - message = strings.ReplaceAll(message, "%f", frame.Function) - traces := make([]string, 0, len(e.ProgramCounters())) - traces = append(traces, message) - - for ok { - trace := strings.ReplaceAll(traceFormat, "%m", e.message) - trace = strings.ReplaceAll(trace, "%p", frame.File) - trace = strings.ReplaceAll(trace, "%l", strconv.Itoa(frame.Line)) - trace = strings.ReplaceAll(trace, "%f", frame.Function) - - traces = append(traces, trace) - frame, ok = rframes.Next() - } - - return traces -} - -// New returns a new instance of Error with the relavant fields initialized -func New(msg string) *Error { - return newerr(nil, msg, defaultErrType, 3) -} - -func Newf(fromat string, args ...interface{}) *Error { - return newerrf(nil, defaultErrType, 4, fromat, args...) -} - -// Errorf is a convenience method to create a new instance of Error with formatted message -// Important: %w directive is not supported, use fmt.Errorf if you're using the %w directive or -// use Wrap/Wrapf to wrap an error. -func Errorf(fromat string, args ...interface{}) *Error { - return newerrf(nil, defaultErrType, 4, fromat, args...) -} - -// SetDefaultType will set the default error type, which is used in the 'New' function -func SetDefaultType(e errType) { - defaultErrType = e -} - -// Stacktrace returns a string representation of the stacktrace, where each trace is separated by a newline and tab '\t' -func Stacktrace(err error) string { - trace := make([][]string, 0, 128) - for err != nil { - e, ok := err.(*Error) - if ok { - trace = append(trace, e.StackTrace()) - } else { - trace = append(trace, []string{err.Error()}) - } - err = Unwrap(err) - } - - lookup := map[string]struct{}{} - for idx := len(trace) - 1; idx >= 0; idx-- { - list := trace[idx] - uniqueList := make([]string, 0, len(list)) - for _, line := range list { - _, ok := lookup[line] - if ok { - break - } - uniqueList = append(uniqueList, line) - lookup[line] = struct{}{} - } - trace[idx] = uniqueList - } - final := make([]string, 0, len(trace)*3) - for _, list := range trace { - final = append(final, list...) - } - - return strings.Join(final, "\n") -} - -// Stacktrace returns a string representation of the stacktrace, as a slice of string where each -// element represents the error message and traces. -func StacktraceNoFormat(err error) []string { - trace := make([][]string, 0, 128) - for err != nil { - e, ok := err.(*Error) - if ok { - trace = append(trace, e.StackTraceNoFormat()) - } else { - trace = append(trace, []string{err.Error()}) - } - err = Unwrap(err) - } - - lookup := map[string]struct{}{} - for idx := len(trace) - 1; idx >= 0; idx-- { - list := trace[idx] - uniqueList := make([]string, 0, len(list)) - for _, line := range list { - _, ok := lookup[line] - if ok { - break - } - uniqueList = append(uniqueList, line) - lookup[line] = struct{}{} - } - trace[idx] = uniqueList - } - final := make([]string, 0, len(trace)*3) - for _, list := range trace { - final = append(final, list...) - } - - return final -} - -// StacktraceCustomFormat lets you prepare a stacktrace in a custom format -/* -msgformat - is used to format the line which prints message from Error.message -traceFormat - is used to format the line which prints trace -Supported directives: -%m - message if err type is *Error, otherwise output of `.Error()` -%p - file path, empty if type is not *Error -%l - line, empty if type is not *Error -%f - function, empty if type is not *Error -*/ -func StacktraceCustomFormat(msgformat string, traceFormat string, err error) string { - trace := make([][]string, 0, 128) - for err != nil { - e, ok := err.(*Error) - if ok { - trace = append(trace, e.StackTraceCustomFormat(msgformat, traceFormat)) - } else { - message := strings.ReplaceAll(msgformat, "%m", err.Error()) - message = strings.ReplaceAll(message, "%p", "") - message = strings.ReplaceAll(message, "%l", "") - message = strings.ReplaceAll(message, "%f", "") - trace = append(trace, []string{message}) - } - err = Unwrap(err) - } - - lookup := map[string]struct{}{} - for idx := len(trace) - 1; idx >= 0; idx-- { - list := trace[idx] - uniqueList := make([]string, 0, len(list)) - for _, line := range list { - _, ok := lookup[line] - if ok { - break - } - uniqueList = append(uniqueList, line) - lookup[line] = struct{}{} - } - trace[idx] = uniqueList - } - - final := make([]string, 0, len(trace)*3) - for _, list := range trace { - final = append(final, list...) - } - - return strings.Join(final, "") -} - -func ProgramCounters(err error) []uintptr { - pcs := make([][]uintptr, 0, 128) - for err != nil { - e, ok := err.(*Error) - if ok { - pcs = append(pcs, e.ProgramCounters()) - } - err = Unwrap(err) - } - - lookup := map[uintptr]struct{}{} - for idx := len(pcs) - 1; idx >= 0; idx-- { - list := pcs[idx] - uniqueList := make([]uintptr, 0, len(list)) - for _, line := range list { - _, ok := lookup[line] - if ok { - break - } - uniqueList = append(uniqueList, line) - lookup[line] = struct{}{} - } - pcs[idx] = uniqueList - } - final := make([]uintptr, 0, len(pcs)*3) - for _, list := range pcs { - final = append(final, list...) - } - return final -} - -func RuntimeFrames(err error) *runtime.Frames { - pcs := ProgramCounters(err) - return runtime.CallersFrames(pcs) -} - -func StacktraceFromPcs(err error) string { - pcs := ProgramCounters(err) - frames := runtime.CallersFrames(pcs) - frame, hasMore := frames.Next() - lines := make([]string, 0, len(pcs)) - if !hasMore { - lines = append(lines, frame.File+":"+strconv.Itoa(frame.Line)+":"+frame.Function+"()") - } - for hasMore { - lines = append(lines, frame.File+":"+strconv.Itoa(frame.Line)+":"+frame.Function+"()") - frame, hasMore = frames.Next() - } - - return strings.Join(lines, "\n") -} diff --git a/vendor/github.com/bnkamalesh/errors/helper.go b/vendor/github.com/bnkamalesh/errors/helper.go deleted file mode 100644 index 2818615..0000000 --- a/vendor/github.com/bnkamalesh/errors/helper.go +++ /dev/null @@ -1,370 +0,0 @@ -package errors - -import ( - "errors" - "fmt" - "net/http" - "runtime" - "strings" -) - -func newerr(e error, message string, etype errType, skip int) *Error { - pcs := make([]uintptr, 128) - _ = runtime.Callers(skip, pcs) - return &Error{ - original: e, - message: message, - eType: etype, - pcs: pcs, - pc: pcs[0] - 1, - } -} - -func newerrf(e error, etype errType, skip int, format string, args ...interface{}) *Error { - message := fmt.Sprintf(format, args...) - return newerr(e, message, etype, skip) -} - -func getErrType(err error) errType { - e, _ := err.(*Error) - if e == nil { - return TypeInternal - } - return e.Type() -} - -// Wrap is used to simply wrap an error with optional message; error type would be the -// default error type set using SetDefaultType; TypeInternal otherwise -// If the error being wrapped is already of type Error, then its respective type is used -func Wrap(original error, msg ...string) *Error { - message := strings.Join(msg, ". ") - return newerr(original, message, getErrType(original), 3) -} - -func Wrapf(original error, format string, args ...interface{}) *Error { - return newerrf(original, getErrType(original), 4, format, args...) -} - -// Deprecated: WrapWithMsg [deprecated, use `Wrap`] wrap error with a user friendly message -func WrapWithMsg(original error, msg string) *Error { - return newerr(original, msg, getErrType(original), 3) -} - -// NewWithType returns an error instance with custom error type -func NewWithType(msg string, etype errType) *Error { - return newerr(nil, msg, etype, 3) -} - -// NewWithTypef returns an error instance with custom error type. And formatted message -func NewWithTypef(etype errType, format string, args ...interface{}) *Error { - return newerrf(nil, etype, 4, format, args...) -} - -// NewWithErrMsgType returns an error instance with custom error type and message -func NewWithErrMsgType(original error, message string, etype errType) *Error { - return newerr(original, message, etype, 3) -} - -// NewWithErrMsgTypef returns an error instance with custom error type and formatted message -func NewWithErrMsgTypef(original error, etype errType, format string, args ...interface{}) *Error { - return newerrf(original, etype, 4, format, args...) -} - -// Internal helper method for creating internal errors -func Internal(message string) *Error { - return newerr(nil, message, TypeInternal, 3) -} - -// Internalf helper method for creating internal errors with formatted message -func Internalf(format string, args ...interface{}) *Error { - return newerrf(nil, TypeInternal, 4, format, args...) -} - -// Validation is a helper function to create a new error of type TypeValidation -func Validation(message string) *Error { - return newerr(nil, message, TypeValidation, 3) -} - -// Validationf is a helper function to create a new error of type TypeValidation, with formatted message -func Validationf(format string, args ...interface{}) *Error { - return newerrf(nil, TypeValidation, 4, format, args...) -} - -// InputBody is a helper function to create a new error of type TypeInputBody -func InputBody(message string) *Error { - return newerr(nil, message, TypeInputBody, 3) -} - -// InputBodyf is a helper function to create a new error of type TypeInputBody, with formatted message -func InputBodyf(format string, args ...interface{}) *Error { - return newerrf(nil, TypeInputBody, 4, format, args...) -} - -// Duplicate is a helper function to create a new error of type TypeDuplicate -func Duplicate(message string) *Error { - return newerr(nil, message, TypeDuplicate, 3) -} - -// Duplicatef is a helper function to create a new error of type TypeDuplicate, with formatted message -func Duplicatef(format string, args ...interface{}) *Error { - return newerrf(nil, TypeDuplicate, 4, format, args...) -} - -// Unauthenticated is a helper function to create a new error of type TypeUnauthenticated -func Unauthenticated(message string) *Error { - return newerr(nil, message, TypeUnauthenticated, 3) -} - -// Unauthenticatedf is a helper function to create a new error of type TypeUnauthenticated, with formatted message -func Unauthenticatedf(format string, args ...interface{}) *Error { - return newerrf(nil, TypeUnauthenticated, 4, format, args...) - -} - -// Unauthorized is a helper function to create a new error of type TypeUnauthorized -func Unauthorized(message string) *Error { - return newerr(nil, message, TypeUnauthorized, 3) -} - -// Unauthorizedf is a helper function to create a new error of type TypeUnauthorized, with formatted message -func Unauthorizedf(format string, args ...interface{}) *Error { - return newerrf(nil, TypeUnauthorized, 4, format, args...) -} - -// Empty is a helper function to create a new error of type TypeEmpty -func Empty(message string) *Error { - return newerr(nil, message, TypeEmpty, 3) -} - -// Emptyf is a helper function to create a new error of type TypeEmpty, with formatted message -func Emptyf(format string, args ...interface{}) *Error { - return newerrf(nil, TypeEmpty, 4, format, args...) -} - -// NotFound is a helper function to create a new error of type TypeNotFound -func NotFound(message string) *Error { - return newerr(nil, message, TypeNotFound, 3) -} - -// NotFoundf is a helper function to create a new error of type TypeNotFound, with formatted message -func NotFoundf(format string, args ...interface{}) *Error { - return newerrf(nil, TypeNotFound, 4, format, args...) -} - -// MaximumAttempts is a helper function to create a new error of type TypeMaximumAttempts -func MaximumAttempts(message string) *Error { - return newerr(nil, message, TypeMaximumAttempts, 3) -} - -// MaximumAttemptsf is a helper function to create a new error of type TypeMaximumAttempts, with formatted message -func MaximumAttemptsf(format string, args ...interface{}) *Error { - return newerrf(nil, TypeMaximumAttempts, 4, format, args...) -} - -// SubscriptionExpired is a helper function to create a new error of type TypeSubscriptionExpired -func SubscriptionExpired(message string) *Error { - return newerr(nil, message, TypeSubscriptionExpired, 3) -} - -// SubscriptionExpiredf is a helper function to create a new error of type TypeSubscriptionExpired, with formatted message -func SubscriptionExpiredf(format string, args ...interface{}) *Error { - return newerrf(nil, TypeSubscriptionExpired, 4, format, args...) -} - -// DownstreamDependencyTimedout is a helper function to create a new error of type TypeDownstreamDependencyTimedout -func DownstreamDependencyTimedout(message string) *Error { - return newerr(nil, message, TypeDownstreamDependencyTimedout, 3) -} - -// DownstreamDependencyTimedoutf is a helper function to create a new error of type TypeDownstreamDependencyTimedout, with formatted message -func DownstreamDependencyTimedoutf(format string, args ...interface{}) *Error { - return newerrf(nil, TypeDownstreamDependencyTimedout, 4, format, args...) -} - -// InternalErr helper method for creation internal errors which also accepts an original error -func InternalErr(original error, message string) *Error { - return newerr(original, message, TypeInternal, 3) -} - -// InternalErr helper method for creation internal errors which also accepts an original error, with formatted message -func InternalErrf(original error, format string, args ...interface{}) *Error { - return newerrf(original, TypeInternal, 4, format, args...) -} - -// ValidationErr helper method for creation validation errors which also accepts an original error -func ValidationErr(original error, message string) *Error { - return newerr(original, message, TypeValidation, 3) -} - -// ValidationErr helper method for creation validation errors which also accepts an original error, with formatted message -func ValidationErrf(original error, format string, args ...interface{}) *Error { - return newerrf(original, TypeValidation, 4, format, args...) -} - -// InputBodyErr is a helper function to create a new error of type TypeInputBody which also accepts an original error -func InputBodyErr(original error, message string) *Error { - return newerr(original, message, TypeInputBody, 3) -} - -// InputBodyErrf is a helper function to create a new error of type TypeInputBody which also accepts an original error, with formatted message -func InputBodyErrf(original error, format string, args ...interface{}) *Error { - return newerrf(original, TypeInputBody, 4, format, args...) -} - -// DuplicateErr is a helper function to create a new error of type TypeDuplicate which also accepts an original error -func DuplicateErr(original error, message string) *Error { - return newerr(original, message, TypeDuplicate, 3) -} - -// DuplicateErrf is a helper function to create a new error of type TypeDuplicate which also accepts an original error, with formatted message -func DuplicateErrf(original error, format string, args ...interface{}) *Error { - return newerrf(original, TypeDuplicate, 4, format, args...) -} - -// UnauthenticatedErr is a helper function to create a new error of type TypeUnauthenticated which also accepts an original error -func UnauthenticatedErr(original error, message string) *Error { - return newerr(original, message, TypeUnauthenticated, 3) -} - -// UnauthenticatedErrf is a helper function to create a new error of type TypeUnauthenticated which also accepts an original error, with formatted message -func UnauthenticatedErrf(original error, format string, args ...interface{}) *Error { - return newerrf(original, TypeUnauthenticated, 4, format, args...) -} - -// UnauthorizedErr is a helper function to create a new error of type TypeUnauthorized which also accepts an original error -func UnauthorizedErr(original error, message string) *Error { - return newerr(original, message, TypeUnauthorized, 3) -} - -// UnauthorizedErrf is a helper function to create a new error of type TypeUnauthorized which also accepts an original error, with formatted message -func UnauthorizedErrf(original error, format string, args ...interface{}) *Error { - return newerrf(original, TypeUnauthorized, 4, format, args...) -} - -// EmptyErr is a helper function to create a new error of type TypeEmpty which also accepts an original error -func EmptyErr(original error, message string) *Error { - return newerr(original, message, TypeEmpty, 3) -} - -// EmptyErr is a helper function to create a new error of type TypeEmpty which also accepts an original error, with formatted message -func EmptyErrf(original error, format string, args ...interface{}) *Error { - return newerrf(original, TypeEmpty, 4, format, args...) -} - -// NotFoundErr is a helper function to create a new error of type TypeNotFound which also accepts an original error -func NotFoundErr(original error, message string) *Error { - return newerr(original, message, TypeNotFound, 3) -} - -// NotFoundErrf is a helper function to create a new error of type TypeNotFound which also accepts an original error, with formatted message -func NotFoundErrf(original error, format string, args ...interface{}) *Error { - return newerrf(original, TypeNotFound, 4, format, args...) -} - -// MaximumAttemptsErr is a helper function to create a new error of type TypeMaximumAttempts which also accepts an original error -func MaximumAttemptsErr(original error, message string) *Error { - return newerr(original, message, TypeMaximumAttempts, 3) -} - -// MaximumAttemptsErr is a helper function to create a new error of type TypeMaximumAttempts which also accepts an original error, with formatted message -func MaximumAttemptsErrf(original error, format string, args ...interface{}) *Error { - return newerrf(original, TypeMaximumAttempts, 4, format, args...) -} - -// SubscriptionExpiredErr is a helper function to create a new error of type TypeSubscriptionExpired which also accepts an original error -func SubscriptionExpiredErr(original error, message string) *Error { - return newerr(original, message, TypeSubscriptionExpired, 3) -} - -// SubscriptionExpiredErrf is a helper function to create a new error of type TypeSubscriptionExpired which also accepts an original error, with formatted message -func SubscriptionExpiredErrf(original error, format string, args ...interface{}) *Error { - return newerrf(original, TypeSubscriptionExpired, 4, format, args...) -} - -// DownstreamDependencyTimedoutErr is a helper function to create a new error of type TypeDownstreamDependencyTimedout which also accepts an original error -func DownstreamDependencyTimedoutErr(original error, message string) *Error { - return newerr(original, message, TypeDownstreamDependencyTimedout, 3) -} - -// DownstreamDependencyTimedoutErrf is a helper function to create a new error of type TypeDownstreamDependencyTimedout which also accepts an original error, with formatted message -func DownstreamDependencyTimedoutErrf(original error, format string, args ...interface{}) *Error { - return newerrf(original, TypeDownstreamDependencyTimedout, 4, format, args...) -} - -// HTTPStatusCodeMessage returns the appropriate HTTP status code, message, boolean for the error -// the boolean value is true if the error was of type *Error, false otherwise -func HTTPStatusCodeMessage(err error) (int, string, bool) { - derr, _ := err.(*Error) - if derr != nil { - return derr.HTTPStatusCode(), derr.Message(), true - } - - return http.StatusInternalServerError, err.Error(), false -} - -// HTTPStatusCode returns appropriate HTTP response status code based on type of the error. The boolean -// is 'true' if the provided error is of type *Err -func HTTPStatusCode(err error) (int, bool) { - derr, _ := err.(*Error) - if derr != nil { - return derr.HTTPStatusCode(), true - } - return http.StatusInternalServerError, false -} - -// ErrWithoutTrace is a duplicate of Message, but with clearer name. The boolean is 'true' if the -// provided err is of type *Error -func ErrWithoutTrace(err error) (string, bool) { - return Message(err) -} - -// Message recursively concatenates all the messages set while creating/wrapping the errors. The boolean -// is 'true' if the provided error is of type *Err -func Message(err error) (string, bool) { - derr, _ := err.(*Error) - if derr != nil { - return derr.Message(), true - } - return "", false -} - -// WriteHTTP is a convenience method which will check if the error is of type *Error and -// respond appropriately -func WriteHTTP(err error, w http.ResponseWriter) { - // INFO: consider sending back "unknown server error" message - status, msg, _ := HTTPStatusCodeMessage(err) - w.WriteHeader(status) - w.Write([]byte(msg)) -} - -// Type returns the errType if it's an instance of *Error, -1 otherwise -func Type(err error) errType { - e, ok := err.(*Error) - if !ok { - return errType(-1) - } - return e.Type() -} - -// Type returns the errType as integer if it's an instance of *Error, -1 otherwise -func TypeInt(err error) int { - return Type(err).Int() -} - -// HasType will check if the provided err type is available anywhere nested in the error -func HasType(err error, et errType) bool { - if err == nil { - return false - } - - e, _ := err.(*Error) - if e == nil { - return HasType(errors.Unwrap(err), et) - } - - if e.Type() == et { - return true - } - - return HasType(e.Unwrap(), et) -} diff --git a/vendor/github.com/bnkamalesh/errors/mirror.go b/vendor/github.com/bnkamalesh/errors/mirror.go deleted file mode 100644 index 6000e38..0000000 --- a/vendor/github.com/bnkamalesh/errors/mirror.go +++ /dev/null @@ -1,18 +0,0 @@ -package errors - -import "errors" - -// Unwrap calls the Go builtin errors.UnUnwrap -func Unwrap(err error) error { - return errors.Unwrap(err) -} - -// Is calls the Go builtin errors.Is -func Is(err, target error) bool { - return errors.Is(err, target) -} - -// As calls the Go builtin errors.As -func As(err error, target interface{}) bool { - return errors.As(err, target) -} diff --git a/vendor/github.com/bnkamalesh/webgo/v6/.gitignore b/vendor/github.com/bnkamalesh/webgo/v6/.gitignore deleted file mode 100644 index 364bf73..0000000 --- a/vendor/github.com/bnkamalesh/webgo/v6/.gitignore +++ /dev/null @@ -1,87 +0,0 @@ -# Created by https://www.gitignore.io/api/go,osx,linux,windows - -### Go ### -# Binaries for programs and plugins -*.exe -*.dll -*.so -*.dylib - -# Test binary, build with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 -.glide/ - -# Golang project vendor packages which should be ignored -vendor/ - -### Linux ### -*~ - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* - -# .nfs files are created when an open file is removed but is still being accessed -.nfs* - -### OSX ### -*.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -### Windows ### -# Windows thumbnail cache files -Thumbs.db -ehthumbs.db -ehthumbs_vista.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# End of https://www.gitignore.io/api/go,osx,linux,windows - -.vscode \ No newline at end of file diff --git a/vendor/github.com/bnkamalesh/webgo/v6/CODE_OF_CONDUCT.md b/vendor/github.com/bnkamalesh/webgo/v6/CODE_OF_CONDUCT.md deleted file mode 100644 index b7a06a5..0000000 --- a/vendor/github.com/bnkamalesh/webgo/v6/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,46 +0,0 @@ -# Contributor Covenant 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, 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 bn_kamalesh@yahoo.com. The project team will review and investigate all complaints, and will respond in a way that it deems 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 [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/bnkamalesh/webgo/v6/CONTRIBUTING.md b/vendor/github.com/bnkamalesh/webgo/v6/CONTRIBUTING.md deleted file mode 100644 index 797b0fa..0000000 --- a/vendor/github.com/bnkamalesh/webgo/v6/CONTRIBUTING.md +++ /dev/null @@ -1,24 +0,0 @@ -Contributions are welcome from everyone. Please adhere to the [code of conduct](https://github.com/bnkamalesh/webgo/blob/master/CODE_OF_CONDUCT.md) of the project, and be respectful to all. - -Please follow the guidelines provided for contribution - -1. Updates to the project are only accepted via Pull Requests (PR) -2. Pull requests will be reviewed & tested -3. Every PR should be accompanied by its test wherever applicable -4. While creating an issue - 1. Mention the steps to reproduce the issue - 2. Mention the environment in which it was run - 3. Include your 1st level of troubleshooting results -5. Provide meaningful commit messages - - -### Versioning & PR messages - -WebGo tries to use [semantic versioning](https://semver.org/) and starting recently, have decided to adhere to the following syntax in PR description. List down the changes as bulleted list, as follows: - -```markdown -[major] any backward incompatible or breaking change -[minor] any new feature -[patch] enhancements of existing features, refactor, bug fix etc. -[-] for changes which does not require a version number update -``` diff --git a/vendor/github.com/bnkamalesh/webgo/v6/LICENSE b/vendor/github.com/bnkamalesh/webgo/v6/LICENSE deleted file mode 100644 index 680becd..0000000 --- a/vendor/github.com/bnkamalesh/webgo/v6/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016 Kamaleshwar - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/vendor/github.com/bnkamalesh/webgo/v6/README.md b/vendor/github.com/bnkamalesh/webgo/v6/README.md deleted file mode 100644 index 5d13117..0000000 --- a/vendor/github.com/bnkamalesh/webgo/v6/README.md +++ /dev/null @@ -1,222 +0,0 @@ -

webgo gopher

- -[![](https://github.com/bnkamalesh/webgo/actions/workflows/tests.yaml/badge.svg)](https://github.com/bnkamalesh/webgo/actions/workflows/tests.yaml) -[![coverage](https://img.shields.io/codecov/c/github/bnkamalesh/webgo.svg)](https://codecov.io/gh/bnkamalesh/webgo) -[![](https://goreportcard.com/badge/github.com/bnkamalesh/webgo)](https://goreportcard.com/report/github.com/bnkamalesh/webgo) -[![](https://api.codeclimate.com/v1/badges/85b3a55c3fa6b4c5338d/maintainability)](https://codeclimate.com/github/bnkamalesh/webgo/maintainability) -[![](https://godoc.org/github.com/nathany/looper?status.svg)](http://godoc.org/github.com/bnkamalesh/webgo) -[![](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go#web-frameworks) - -# WebGo v6.7.0 - -WebGo is a minimalistic router for [Go](https://golang.org) to build web applications (server side) with no 3rd party dependencies. WebGo will always be Go standard library compliant; with the HTTP handlers having the same signature as [http.HandlerFunc](https://golang.org/pkg/net/http/#HandlerFunc). - -### Contents - -1. [Router](https://github.com/bnkamalesh/webgo#router) -2. [Handler chaining](https://github.com/bnkamalesh/webgo#handler-chaining) -3. [Middleware](https://github.com/bnkamalesh/webgo#middleware) -4. [Error handling](https://github.com/bnkamalesh/webgo#error-handling) -5. [Helper functions](https://github.com/bnkamalesh/webgo#helper-functions) -6. [HTTPS ready](https://github.com/bnkamalesh/webgo#https-ready) -7. [Graceful shutdown](https://github.com/bnkamalesh/webgo#graceful-shutdown) -8. [Logging](https://github.com/bnkamalesh/webgo#logging) -9. [Server-Sent Events](https://github.com/bnkamalesh/webgo#server-sent-events) -10. [Usage](https://github.com/bnkamalesh/webgo#usage) - -## Router - -Webgo has a simplistic, linear path matching router and supports defining [URI](https://developer.mozilla.org/en-US/docs/Glossary/URI)s with the following patterns - -1. `/api/users` - URI with no dynamic values -2. `/api/users/:userID` - - URI with a named parameter, `userID` - - If TrailingSlash is set to true, it will accept the URI ending with a '/', refer to [sample](https://github.com/bnkamalesh/webgo#sample) -3. `/api/users/:misc*` - - Named URI parameter `misc`, with a wildcard suffix '\*' - - This matches everything after `/api/users`. e.g. `/api/users/a/b/c/d` - -When there are multiple handlers matching the same URI, only the first occurring handler will handle the request. -Refer to the [sample](https://github.com/bnkamalesh/webgo#sample) to see how routes are configured. You can access named parameters of the URI using the `Context` function. - -Note: webgo Context is **not** available inside the special handlers (not found & method not implemented) - -```golang -func helloWorld(w http.ResponseWriter, r *http.Request) { - // WebGo context - wctx := webgo.Context(r) - // URI paramaters, map[string]string - params := wctx.Params() - // route, the webgo.Route which is executing this request - route := wctx.Route - webgo.R200( - w, - fmt.Sprintf( - "Route name: '%s', params: '%s'", - route.Name, - params, - ), - ) -} -``` - -## Handler chaining - -Handler chaining lets you execute multiple handlers for a given route. Execution of a chain can be configured to run even after a handler has written a response to the HTTP request, if you set `FallThroughPostResponse` to `true` (refer [sample](https://github.com/bnkamalesh/webgo/blob/master/cmd/main.go#L70)). - -## Middleware - -WebGo [middlware](https://godoc.org/github.com/bnkamalesh/webgo#Middleware) lets you wrap all the routes with a middleware unlike handler chaining. The router exposes a method [Use](https://godoc.org/github.com/bnkamalesh/webgo#Router.Use) && [UseOnSpecialHandlers](https://godoc.org/github.com/bnkamalesh/webgo#Router.UseOnSpecialHandlers) to add a Middleware to the router. - -NotFound && NotImplemented are considered `Special` handlers. `webgo.Context(r)` within special handlers will return `nil`. - -Any number of middleware can be added to the router, the order of execution of middleware would be [LIFO]() (Last In First Out). i.e. in case of the following code - -```golang -func main() { - router.Use(accesslog.AccessLog, cors.CORS(nil)) - router.Use() -} -``` - -**_CorsWrap_** would be executed first, followed by **_AccessLog_**. - -## Error handling - -Webgo context has 2 methods to [set](https://github.com/bnkamalesh/webgo/blob/master/webgo.go#L60) & [get](https://github.com/bnkamalesh/webgo/blob/master/webgo.go#L66) erro within a request context. It enables Webgo to implement a single middleware where you can handle error returned within an HTTP handler. [set error](https://github.com/bnkamalesh/webgo/blob/master/cmd/main.go#L45), [get error](https://github.com/bnkamalesh/webgo/blob/master/cmd/main.go#L51). - -## Helper functions - -WebGo provides a few helper functions. When using `Send` or `SendResponse` (other Rxxx responder functions), the response is wrapped in WebGo's [response struct](https://github.com/bnkamalesh/webgo/blob/master/responses.go#L17) and is serialized as JSON. - -```json -{ - "data": "", - "status": "" -} -``` - -When using `SendError`, the response is wrapped in WebGo's [error response struct](https://github.com/bnkamalesh/webgo/blob/master/responses.go#L23) and is serialzied as JSON. - -```json -{ - "errors": "", - "status": "" -} -``` - -## HTTPS ready - -HTTPS server can be started easily, by providing the key & cert file. You can also have both HTTP & HTTPS servers running side by side. - -Start HTTPS server - -```golang -cfg := &webgo.Config{ - Port: "80", - HTTPSPort: "443", - CertFile: "/path/to/certfile", - KeyFile: "/path/to/keyfile", -} -router := webgo.NewRouter(cfg, routes()...) -router.StartHTTPS() -``` - -Starting both HTTP & HTTPS server - -```golang -cfg := &webgo.Config{ - Port: "80", - HTTPSPort: "443", - CertFile: "/path/to/certfile", - KeyFile: "/path/to/keyfile", -} - -router := webgo.NewRouter(cfg, routes()...) -go router.StartHTTPS() -router.Start() -``` - -## Graceful shutdown - -Graceful shutdown lets you shutdown the server without affecting any live connections/clients connected to the server. Any new connection request after initiating a shutdown would be ignored. - -Sample code to show how to use shutdown - -```golang -func main() { - osSig := make(chan os.Signal, 5) - - cfg := &webgo.Config{ - Host: "", - Port: "8080", - ReadTimeout: 15 * time.Second, - WriteTimeout: 60 * time.Second, - ShutdownTimeout: 15 * time.Second, - } - router := webgo.NewRouter(cfg, routes()...) - - go func() { - <-osSig - // Initiate HTTP server shutdown - err := router.Shutdown() - if err != nil { - fmt.Println(err) - os.Exit(1) - } else { - fmt.Println("shutdown complete") - os.Exit(0) - } - - // If you have HTTPS server running, you can use the following code - // err := router.ShutdownHTTPS() - // if err != nil { - // fmt.Println(err) - // os.Exit(1) - // } else { - // fmt.Println("shutdown complete") - // os.Exit(0) - // } - }() - - go func(){ - time.Sleep(time.Second*15) - signal.Notify(osSig, os.Interrupt, syscall.SIGTERM) - }() - - router.Start() -} -``` - -## Logging - -WebGo exposes a singleton & global scoped logger variable [LOGHANDLER](https://godoc.org/github.com/bnkamalesh/webgo#Logger) with which you can plug in your custom logger by implementing the [Logger](https://godoc.org/github.com/bnkamalesh/webgo#Logger) interface. - -### Configuring the default Logger - -The default logger uses Go standard library's `log.Logger` with `os.Stdout` (for debug and info logs) & `os.Stderr` (for warning, error, fatal) as default io.Writers. You can set the io.Writer as well as disable specific types of logs using the `GlobalLoggerConfig(stdout, stderr, cfgs...)` function. - -## Server-Sent Events - -[MDN has a very good documentation of what SSE (Server-Sent Events)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events) are. The sample app provided shows how to use the SSE extension of webgo. - -## Usage - -A fully functional sample is provided [here](https://github.com/bnkamalesh/webgo/blob/master/cmd/main.go). - -### Benchmark - -1. [the-benchmarker](https://github.com/the-benchmarker/web-frameworks) -2. [go-web-framework-benchmark](https://github.com/smallnest/go-web-framework-benchmark) - -### Contributing - -Refer [here](https://github.com/bnkamalesh/webgo/blob/master/CONTRIBUTING.md) to find out details about making a contribution - -### Credits - -Thanks to all the [contributors](https://github.com/bnkamalesh/webgo/graphs/contributors) - -## The gopher - -The gopher used here was created using [Gopherize.me](https://gopherize.me/). WebGo stays out of developers' way, so sitback and enjoy a cup of coffee. diff --git a/vendor/github.com/bnkamalesh/webgo/v6/_config.yml b/vendor/github.com/bnkamalesh/webgo/v6/_config.yml deleted file mode 100644 index c419263..0000000 --- a/vendor/github.com/bnkamalesh/webgo/v6/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-cayman \ No newline at end of file diff --git a/vendor/github.com/bnkamalesh/webgo/v6/config.go b/vendor/github.com/bnkamalesh/webgo/v6/config.go deleted file mode 100644 index e9b4df0..0000000 --- a/vendor/github.com/bnkamalesh/webgo/v6/config.go +++ /dev/null @@ -1,66 +0,0 @@ -package webgo - -import ( - "encoding/json" - "io/ioutil" - "strconv" - "time" -) - -// Config is used for reading app's configuration from json file -type Config struct { - // Host is the host on which the server is listening - Host string `json:"host,omitempty"` - // Port is the port number where the server has to listen for the HTTP requests - Port string `json:"port,omitempty"` - - // CertFile is the TLS/SSL certificate file path, required for HTTPS - CertFile string `json:"certFile,omitempty"` - // KeyFile is the filepath of private key of the certificate - KeyFile string `json:"keyFile,omitempty"` - // HTTPSPort is the port number where the server has to listen for the HTTP requests - HTTPSPort string `json:"httpsPort,omitempty"` - - // ReadTimeout is the maximum duration for which the server would read a request - ReadTimeout time.Duration `json:"readTimeout,omitempty"` - // WriteTimeout is the maximum duration for which the server would try to respond - WriteTimeout time.Duration `json:"writeTimeout,omitempty"` - - // InsecureSkipVerify is the HTTP certificate verification - InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"` - - // ShutdownTimeout is the duration in which graceful shutdown is completed - ShutdownTimeout time.Duration -} - -// Load config file from the provided filepath and validate -func (cfg *Config) Load(filepath string) { - file, err := ioutil.ReadFile(filepath) - if err != nil { - LOGHANDLER.Fatal(err) - } - - err = json.Unmarshal(file, cfg) - if err != nil { - LOGHANDLER.Fatal(err) - } - - err = cfg.Validate() - if err != nil { - LOGHANDLER.Fatal(ErrInvalidPort) - } -} - -// Validate the config parsed into the Config struct -func (cfg *Config) Validate() error { - i, err := strconv.Atoi(cfg.Port) - if err != nil { - return ErrInvalidPort - } - - if i <= 0 || i > 65535 { - return ErrInvalidPort - } - - return nil -} diff --git a/vendor/github.com/bnkamalesh/webgo/v6/errors.go b/vendor/github.com/bnkamalesh/webgo/v6/errors.go deleted file mode 100644 index 0ebeff3..0000000 --- a/vendor/github.com/bnkamalesh/webgo/v6/errors.go +++ /dev/null @@ -1,145 +0,0 @@ -package webgo - -import ( - "errors" - "io" - "log" - "os" -) - -var ( - // ErrInvalidPort is the error returned when the port number provided in the config file is invalid - ErrInvalidPort = errors.New("Port number not provided or is invalid (should be between 0 - 65535)") - - lh *logHandler -) - -type logCfg string - -const ( - // LogCfgDisableDebug is used to disable debug logs - LogCfgDisableDebug = logCfg("disable-debug") - // LogCfgDisableInfo is used to disable info logs - LogCfgDisableInfo = logCfg("disable-info") - // LogCfgDisableWarn is used to disable warning logs - LogCfgDisableWarn = logCfg("disable-warn") - // LogCfgDisableError is used to disable error logs - LogCfgDisableError = logCfg("disable-err") - // LogCfgDisableFatal is used to disable fatal logs - LogCfgDisableFatal = logCfg("disable-fatal") -) - -// Logger defines all the logging methods to be implemented -type Logger interface { - Debug(data ...interface{}) - Info(data ...interface{}) - Warn(data ...interface{}) - Error(data ...interface{}) - Fatal(data ...interface{}) -} - -// logHandler has all the log writer handlers -type logHandler struct { - debug *log.Logger - info *log.Logger - warn *log.Logger - err *log.Logger - fatal *log.Logger -} - -// Debug prints log of severity 5 -func (lh *logHandler) Debug(data ...interface{}) { - if lh.debug == nil { - return - } - lh.debug.Println(data...) -} - -// Info prints logs of severity 4 -func (lh *logHandler) Info(data ...interface{}) { - if lh.info == nil { - return - } - lh.info.Println(data...) -} - -// Warn prints log of severity 3 -func (lh *logHandler) Warn(data ...interface{}) { - if lh.warn == nil { - return - } - lh.warn.Println(data...) -} - -// Error prints log of severity 2 -func (lh *logHandler) Error(data ...interface{}) { - if lh.err == nil { - return - } - lh.err.Println(data...) -} - -// Fatal prints log of severity 1 -func (lh *logHandler) Fatal(data ...interface{}) { - if lh.fatal == nil { - return - } - lh.fatal.Fatalln(data...) -} - -// LOGHANDLER is a global variable which webgo uses to log messages -var LOGHANDLER Logger - -func init() { - GlobalLoggerConfig(nil, nil) -} - -func loggerWithCfg(stdout io.Writer, stderr io.Writer, cfgs ...logCfg) *logHandler { - lh = &logHandler{ - debug: log.New(stdout, "Debug ", log.LstdFlags), - info: log.New(stdout, "Info ", log.LstdFlags), - warn: log.New(stderr, "Warning ", log.LstdFlags), - err: log.New(stderr, "Error ", log.LstdFlags), - fatal: log.New(stderr, "Fatal ", log.LstdFlags|log.Llongfile), - } - - for _, c := range cfgs { - switch c { - case LogCfgDisableDebug: - { - lh.debug = nil - } - case LogCfgDisableInfo: - { - lh.info = nil - } - case LogCfgDisableWarn: - { - lh.warn = nil - } - case LogCfgDisableError: - { - lh.err = nil - } - case LogCfgDisableFatal: - { - lh.fatal = nil - } - } - } - return lh -} - -// GlobalLoggerConfig is used to configure the global/default logger of webgo -// IMPORTANT: This is not concurrent safe -func GlobalLoggerConfig(stdout io.Writer, stderr io.Writer, cfgs ...logCfg) { - if stdout == nil { - stdout = os.Stdout - } - - if stderr == nil { - stderr = os.Stderr - } - - LOGHANDLER = loggerWithCfg(stdout, stderr, cfgs...) -} diff --git a/vendor/github.com/bnkamalesh/webgo/v6/middleware/accesslog/accesslog.go b/vendor/github.com/bnkamalesh/webgo/v6/middleware/accesslog/accesslog.go deleted file mode 100644 index bdab1ba..0000000 --- a/vendor/github.com/bnkamalesh/webgo/v6/middleware/accesslog/accesslog.go +++ /dev/null @@ -1,31 +0,0 @@ -/* -Package accesslogs provides a simple straight forward access log middleware. The logs are of the -following format: - -*/ -package accesslog - -import ( - "fmt" - "net/http" - "time" - - "github.com/bnkamalesh/webgo/v6" -) - -// AccessLog is a middleware which prints access log to stdout -func AccessLog(rw http.ResponseWriter, req *http.Request, next http.HandlerFunc) { - start := time.Now() - next(rw, req) - end := time.Now() - - webgo.LOGHANDLER.Info( - fmt.Sprintf( - "%s %s %s %d", - req.Method, - req.URL.String(), - end.Sub(start).String(), - webgo.ResponseStatus(rw), - ), - ) -} diff --git a/vendor/github.com/bnkamalesh/webgo/v6/responses.go b/vendor/github.com/bnkamalesh/webgo/v6/responses.go deleted file mode 100644 index 3449684..0000000 --- a/vendor/github.com/bnkamalesh/webgo/v6/responses.go +++ /dev/null @@ -1,160 +0,0 @@ -package webgo - -import ( - "encoding/json" - "fmt" - "html/template" - "net/http" -) - -// ErrorData used to render the error page -type ErrorData struct { - ErrCode int - ErrDescription string -} - -// dOutput is the standard/valid output wrapped in `{data: , status: }` -type dOutput struct { - Data interface{} `json:"data"` - Status int `json:"status"` -} - -// errOutput is the error output wrapped in `{errors:, status: }` -type errOutput struct { - Errors interface{} `json:"errors"` - Status int `json:"status"` -} - -const ( - // HeaderContentType is the key for mentioning the response header content type - HeaderContentType = "Content-Type" - // JSONContentType is the MIME type when the response is JSON - JSONContentType = "application/json" - // HTMLContentType is the MIME type when the response is HTML - HTMLContentType = "text/html; charset=UTF-8" - - // ErrInternalServer to send when there's an internal server error - ErrInternalServer = "Internal server error" -) - -// SendHeader is used to send only a response header, i.e no response body -func SendHeader(w http.ResponseWriter, rCode int) { - w.WriteHeader(rCode) -} - -func crwAsserter(w http.ResponseWriter, rCode int) http.ResponseWriter { - if crw, ok := w.(*customResponseWriter); ok { - crw.statusCode = rCode - return crw - } - - return newCRW(w, rCode) -} - -// Send sends a completely custom response without wrapping in the -// `{data: , status: ` struct -func Send(w http.ResponseWriter, contentType string, data interface{}, rCode int) { - w = crwAsserter(w, rCode) - w.Header().Set(HeaderContentType, contentType) - _, err := fmt.Fprint(w, data) - if err != nil { - w.WriteHeader(http.StatusInternalServerError) - _, _ = w.Write([]byte(ErrInternalServer)) - LOGHANDLER.Error(err) - } -} - -// SendResponse is used to respond to any request (JSON response) based on the code, data etc. -func SendResponse(w http.ResponseWriter, data interface{}, rCode int) { - w = crwAsserter(w, rCode) - w.Header().Add(HeaderContentType, JSONContentType) - err := json.NewEncoder(w).Encode(dOutput{Data: data, Status: rCode}) - if err != nil { - /* - In case of encoding error, send "internal server error" and - log the actual error. - */ - R500(w, ErrInternalServer) - LOGHANDLER.Error(err) - } -} - -// SendError is used to respond to any request with an error -func SendError(w http.ResponseWriter, data interface{}, rCode int) { - w = crwAsserter(w, rCode) - w.Header().Add(HeaderContentType, JSONContentType) - err := json.NewEncoder(w).Encode(errOutput{data, rCode}) - if err != nil { - /* - In case of encoding error, send "internal server error" and - log the actual error. - */ - R500(w, ErrInternalServer) - LOGHANDLER.Error(err) - } -} - -// Render is used for rendering templates (HTML) -func Render(w http.ResponseWriter, data interface{}, rCode int, tpl *template.Template) { - w = crwAsserter(w, rCode) - - // In case of HTML response, setting appropriate header type for text/HTML response - w.Header().Set(HeaderContentType, HTMLContentType) - - // Rendering an HTML template with appropriate data - err := tpl.Execute(w, data) - if err != nil { - Send(w, "text/plain", ErrInternalServer, http.StatusInternalServerError) - LOGHANDLER.Error(err.Error()) - } -} - -// R200 - Successful/OK response -func R200(w http.ResponseWriter, data interface{}) { - SendResponse(w, data, http.StatusOK) -} - -// R201 - New item created -func R201(w http.ResponseWriter, data interface{}) { - SendResponse(w, data, http.StatusCreated) -} - -// R204 - empty, no content -func R204(w http.ResponseWriter) { - SendHeader(w, http.StatusNoContent) -} - -// R302 - Temporary redirect -func R302(w http.ResponseWriter, data interface{}) { - SendResponse(w, data, http.StatusFound) -} - -// R400 - Invalid request, any incorrect/erraneous value in the request body -func R400(w http.ResponseWriter, data interface{}) { - SendError(w, data, http.StatusBadRequest) -} - -// R403 - Unauthorized access -func R403(w http.ResponseWriter, data interface{}) { - SendError(w, data, http.StatusForbidden) -} - -// R404 - Resource not found -func R404(w http.ResponseWriter, data interface{}) { - SendError(w, data, http.StatusNotFound) -} - -// R406 - Unacceptable header. For any error related to values set in header -func R406(w http.ResponseWriter, data interface{}) { - SendError(w, data, http.StatusNotAcceptable) -} - -// R451 - Resource taken down because of a legal request -func R451(w http.ResponseWriter, data interface{}) { - SendError(w, data, http.StatusUnavailableForLegalReasons) -} - -// R500 - Internal server error -func R500(w http.ResponseWriter, data interface{}) { - SendError(w, data, http.StatusInternalServerError) -} diff --git a/vendor/github.com/bnkamalesh/webgo/v6/route.go b/vendor/github.com/bnkamalesh/webgo/v6/route.go deleted file mode 100644 index ce14cba..0000000 --- a/vendor/github.com/bnkamalesh/webgo/v6/route.go +++ /dev/null @@ -1,252 +0,0 @@ -package webgo - -import ( - "bytes" - "fmt" - "net/http" - "strings" -) - -// Route defines a route for each API -type Route struct { - // Name is unique identifier for the route - Name string - // Method is the HTTP request method/type - Method string - // Pattern is the URI pattern to match - Pattern string - // TrailingSlash if set to true, the URI will be matched with or without - // a trailing slash. IMPORTANT: It does not redirect. - TrailingSlash bool - - // FallThroughPostResponse if enabled will execute all the handlers even if a response was already sent to the client - FallThroughPostResponse bool - - // Handlers is a slice of http.HandlerFunc which can be middlewares or anything else. Though only 1 of them will be allowed to respond to client. - // subsequent writes from the following handlers will be ignored - Handlers []http.HandlerFunc - - hasWildcard bool - fragments []uriFragment - paramsCount int - - // skipMiddleware if true, middleware added using `router` will not be applied to this Route. - // This is used only when a Route is set using the RouteGroup, which can have its own set of middleware - skipMiddleware bool - - initialized bool - - serve http.HandlerFunc -} -type uriFragment struct { - isVariable bool - hasWildcard bool - // fragment will be the key name, if it's a variable/named URI parameter - fragment string -} - -func (r *Route) parseURIWithParams() { - // if there are no URI params, then there's no need to set route parts - if !strings.Contains(r.Pattern, ":") { - return - } - - fragments := strings.Split(r.Pattern, "/") - if len(fragments) == 1 { - return - } - - rFragments := make([]uriFragment, 0, len(fragments)) - for _, fragment := range fragments[1:] { - hasParam := false - hasWildcard := false - - if strings.Contains(fragment, ":") { - hasParam = true - r.paramsCount++ - } - if strings.Contains(fragment, "*") { - r.hasWildcard = true - hasWildcard = true - } - - key := strings.ReplaceAll(fragment, ":", "") - key = strings.ReplaceAll(key, "*", "") - rFragments = append( - rFragments, - uriFragment{ - isVariable: hasParam, - hasWildcard: hasWildcard, - fragment: key, - }) - } - r.fragments = rFragments -} - -// init prepares the URIKeys, compile regex for the provided pattern -func (r *Route) init() error { - if r.initialized { - return nil - } - r.parseURIWithParams() - r.serve = defaultRouteServe(r) - - r.initialized = true - return nil -} - -// matchPath matches the requestURI with the URI pattern of the route -func (r *Route) matchPath(requestURI string) (bool, map[string]string) { - p := bytes.NewBufferString(r.Pattern) - if r.TrailingSlash { - p.WriteString("/") - } else { - if requestURI[len(requestURI)-1] == '/' { - return false, nil - } - } - - if r.Pattern == requestURI || p.String() == requestURI { - return true, nil - } - - return r.matchWithWildcard(requestURI) -} - -func (r *Route) matchWithWildcard(requestURI string) (bool, map[string]string) { - // if r.fragments is empty, it means there are no variables in the URI pattern - // hence no point checking - if len(r.fragments) == 0 { - return false, nil - } - - params := make(map[string]string, r.paramsCount) - uriFragments := strings.Split(requestURI, "/")[1:] - fragmentsLastIdx := len(r.fragments) - 1 - fragmentIdx := 0 - uriParameter := make([]string, 0, len(uriFragments)) - - for idx, fragment := range uriFragments { - // if part is empty, it means it's end of URI with trailing slash - if fragment == "" { - break - } - - if fragmentIdx > fragmentsLastIdx { - return false, nil - } - - currentFragment := r.fragments[fragmentIdx] - if !currentFragment.isVariable && currentFragment.fragment != fragment { - return false, nil - } - - uriParameter = append(uriParameter, fragment) - if currentFragment.isVariable { - params[currentFragment.fragment] = strings.Join(uriParameter, "/") - } - - if !currentFragment.hasWildcard { - uriParameter = make([]string, 0, len(uriFragments)-idx) - fragmentIdx++ - continue - } - - nextIdx := fragmentIdx + 1 - if nextIdx > fragmentsLastIdx { - continue - } - nextPart := r.fragments[nextIdx] - - // if the URI has more fragments/params after wildcard, - // the immediately following part after wildcard cannot be a variable or another wildcard. - if !nextPart.isVariable && nextPart.fragment == fragment { - // remove the last added 'part' from parameters, as it's part of the static URI - params[currentFragment.fragment] = strings.Join(uriParameter[:len(uriParameter)-1], "/") - uriParameter = make([]string, 0, len(uriFragments)-idx) - fragmentIdx += 2 - } - } - - if len(params) != r.paramsCount { - return false, nil - } - - return true, params -} - -func (r *Route) use(mm ...Middleware) { - for idx := range mm { - m := mm[idx] - srv := r.serve - r.serve = func(rw http.ResponseWriter, req *http.Request) { - m(rw, req, srv) - } - } -} - -func routeServeChainedHandlers(r *Route) http.HandlerFunc { - return func(rw http.ResponseWriter, req *http.Request) { - - crw, ok := rw.(*customResponseWriter) - if !ok { - crw = newCRW(rw, http.StatusOK) - } - - for _, handler := range r.Handlers { - if crw.written && !r.FallThroughPostResponse { - break - } - handler(crw, req) - } - } -} - -func defaultRouteServe(r *Route) http.HandlerFunc { - if len(r.Handlers) > 1 { - return routeServeChainedHandlers(r) - } - - // when there is only 1 handler, custom response writer is not required to check if response - // is already written or fallthrough is enabled - return r.Handlers[0] -} - -type RouteGroup struct { - routes []*Route - // skipRouterMiddleware if set to true, middleware applied to the router will not be applied - // to this route group. - skipRouterMiddleware bool - // PathPrefix is the URI prefix for all routes in this group - PathPrefix string -} - -func (rg *RouteGroup) Add(rr ...Route) { - for idx := range rr { - route := rr[idx] - route.skipMiddleware = rg.skipRouterMiddleware - route.Pattern = fmt.Sprintf("%s%s", rg.PathPrefix, route.Pattern) - _ = route.init() - rg.routes = append(rg.routes, &route) - } -} - -func (rg *RouteGroup) Use(mm ...Middleware) { - for idx := range rg.routes { - route := rg.routes[idx] - route.use(mm...) - } -} - -func (rg *RouteGroup) Routes() []*Route { - return rg.routes -} - -func NewRouteGroup(pathPrefix string, skipRouterMiddleware bool, rr ...Route) *RouteGroup { - rg := RouteGroup{ - PathPrefix: pathPrefix, - skipRouterMiddleware: skipRouterMiddleware, - } - rg.Add(rr...) - return &rg -} diff --git a/vendor/github.com/bnkamalesh/webgo/v6/router.go b/vendor/github.com/bnkamalesh/webgo/v6/router.go deleted file mode 100644 index 0334210..0000000 --- a/vendor/github.com/bnkamalesh/webgo/v6/router.go +++ /dev/null @@ -1,418 +0,0 @@ -package webgo - -import ( - "bufio" - "context" - "errors" - "fmt" - "net" - "net/http" - "sync" -) - -// httpResponseWriter has all the functions to be implemented by the custom -// responsewriter used -type httpResponseWriter interface { - http.ResponseWriter - http.CloseNotifier //nolint - http.Flusher - http.Hijacker - http.Pusher -} - -func init() { - // ensure the custom response writer implements all the required functions - crw := &customResponseWriter{} - _ = httpResponseWriter(crw) -} - -var ( - validHTTPMethods = []string{ - http.MethodOptions, - http.MethodHead, - http.MethodGet, - http.MethodPost, - http.MethodPut, - http.MethodPatch, - http.MethodDelete, - } - - ctxPool = &sync.Pool{ - New: func() interface{} { - return new(ContextPayload) - }, - } - crwPool = &sync.Pool{ - New: func() interface{} { - return new(customResponseWriter) - }, - } -) - -// customResponseWriter is a custom HTTP response writer -type customResponseWriter struct { - http.ResponseWriter - statusCode int - written bool - headerWritten bool -} - -// WriteHeader is the interface implementation to get HTTP response code and add -// it to the custom response writer -func (crw *customResponseWriter) WriteHeader(code int) { - if crw.headerWritten { - return - } - - crw.headerWritten = true - crw.statusCode = code - crw.ResponseWriter.WriteHeader(code) -} - -// Write is the interface implementation to respond to the HTTP request, -// but check if a response was already sent. -func (crw *customResponseWriter) Write(body []byte) (int, error) { - crw.WriteHeader(crw.statusCode) - crw.written = true - return crw.ResponseWriter.Write(body) -} - -// Flush calls the http.Flusher to clear/flush the buffer -func (crw *customResponseWriter) Flush() { - if rw, ok := crw.ResponseWriter.(http.Flusher); ok { - rw.Flush() - } -} - -// Hijack implements the http.Hijacker interface -func (crw *customResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) { - if hj, ok := crw.ResponseWriter.(http.Hijacker); ok { - return hj.Hijack() - } - - return nil, nil, errors.New("unable to create hijacker") -} - -// CloseNotify implements the http.CloseNotifier interface -func (crw *customResponseWriter) CloseNotify() <-chan bool { //nolint - if n, ok := crw.ResponseWriter.(http.CloseNotifier); ok { //nolint - return n.CloseNotify() - } - return nil -} - -func (crw *customResponseWriter) Push(target string, opts *http.PushOptions) error { - if n, ok := crw.ResponseWriter.(http.Pusher); ok { - return n.Push(target, opts) - } - return errors.New("pusher not implemented") -} - -func (crw *customResponseWriter) reset() { - crw.statusCode = 0 - crw.written = false - crw.headerWritten = false - crw.ResponseWriter = nil -} - -// Middleware is the signature of WebGo's middleware -type Middleware func(http.ResponseWriter, *http.Request, http.HandlerFunc) - -// discoverRoute returns the correct 'route', for the given request -func discoverRoute(path string, routes []*Route) (*Route, map[string]string) { - for _, route := range routes { - if ok, params := route.matchPath(path); ok { - return route, params - } - } - return nil, nil -} - -// Router is the HTTP router -type Router struct { - optHandlers []*Route - headHandlers []*Route - getHandlers []*Route - postHandlers []*Route - putHandlers []*Route - patchHandlers []*Route - deleteHandlers []*Route - allHandlers map[string][]*Route - - // NotFound is the generic handler for 404 resource not found response - NotFound http.HandlerFunc - - // NotImplemented is the generic handler for 501 method not implemented - NotImplemented http.HandlerFunc - - // config has all the app config - config *Config - - // httpServer is the server handler for the active HTTP server - httpServer *http.Server - // httpsServer is the server handler for the active HTTPS server - httpsServer *http.Server -} - -// methodRoutes returns the list of Routes handling the HTTP method given the request -func (rtr *Router) methodRoutes(method string) (routes []*Route) { - switch method { - case http.MethodOptions: - return rtr.optHandlers - case http.MethodHead: - return rtr.headHandlers - case http.MethodGet: - return rtr.getHandlers - case http.MethodPost: - return rtr.postHandlers - case http.MethodPut: - return rtr.putHandlers - case http.MethodPatch: - return rtr.patchHandlers - case http.MethodDelete: - return rtr.deleteHandlers - } - - return nil -} - -func (rtr *Router) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - // a custom response writer is used to set appropriate HTTP status code in case of - // encoding errors. i.e. if there's a JSON encoding issue while responding, - // the HTTP status code would say 200, and and the JSON payload {"status": 500} - crw := newCRW(rw, http.StatusOK) - - routes := rtr.methodRoutes(r.Method) - if routes == nil { - // serve 501 when HTTP method is not implemented - crw.statusCode = http.StatusNotImplemented - rtr.NotImplemented(crw, r) - releaseCRW(crw) - return - } - - path := r.URL.EscapedPath() - route, params := discoverRoute(path, routes) - if route == nil { - // serve 404 when there are no matching routes - crw.statusCode = http.StatusNotFound - rtr.NotFound(crw, r) - releaseCRW(crw) - return - } - - ctxPayload := newContext() - ctxPayload.Route = route - ctxPayload.URIParams = params - - // webgo context is injected to the HTTP request context - *r = *r.WithContext( - context.WithValue( - r.Context(), - wgoCtxKey, - ctxPayload, - ), - ) - - defer releasePoolResources(crw, ctxPayload) - route.serve(crw, r) - -} - -// Use adds a middleware layer -func (rtr *Router) Use(mm ...Middleware) { - for _, handlers := range rtr.allHandlers { - for idx := range handlers { - route := handlers[idx] - if route.skipMiddleware { - continue - } - - route.use(mm...) - } - } -} - -// UseOnSpecialHandlers adds middleware to the 2 special handlers of webgo -func (rtr *Router) UseOnSpecialHandlers(mm ...Middleware) { - // v3.2.1 introduced the feature of adding middleware to both notfound & not implemented - // handlers - /* - - It was added considering an `accesslog` middleware, where all requests should be logged - # This is now being moved to a separate function considering an authentication middleware, where all requests - including 404 & 501 would respond with `not authenticated` if you do not have special handling - within the middleware. It is a cleaner implementation to avoid this and let users add their - middleware separately to NOTFOUND & NOTIMPLEMENTED handlers - */ - - for idx := range mm { - m := mm[idx] - nf := rtr.NotFound - rtr.NotFound = func(rw http.ResponseWriter, req *http.Request) { - m(rw, req, nf) - } - - ni := rtr.NotImplemented - rtr.NotImplemented = func(rw http.ResponseWriter, req *http.Request) { - m(rw, req, ni) - } - } -} - -// Add is a convenience method used to add a new route to an already initialized router -// Important: `.Use` should be used only after all routes are added -func (rtr *Router) Add(routes ...*Route) { - hmap := httpHandlers(routes) - rtr.optHandlers = append(rtr.optHandlers, hmap[http.MethodOptions]...) - rtr.headHandlers = append(rtr.headHandlers, hmap[http.MethodHead]...) - rtr.getHandlers = append(rtr.getHandlers, hmap[http.MethodGet]...) - rtr.postHandlers = append(rtr.postHandlers, hmap[http.MethodPost]...) - rtr.putHandlers = append(rtr.putHandlers, hmap[http.MethodPut]...) - rtr.patchHandlers = append(rtr.patchHandlers, hmap[http.MethodPatch]...) - rtr.deleteHandlers = append(rtr.deleteHandlers, hmap[http.MethodDelete]...) - - all := rtr.allHandlers - if all == nil { - all = map[string][]*Route{} - } - - for _, key := range supportedHTTPMethods { - newlist, hasKey := hmap[key] - if !hasKey { - continue - } - if all[key] == nil { - all[key] = make([]*Route, 0, len(hmap)) - } - all[key] = append(all[key], newlist...) - } - - rtr.allHandlers = all -} - -func newCRW(rw http.ResponseWriter, rCode int) *customResponseWriter { - crw := crwPool.Get().(*customResponseWriter) - crw.ResponseWriter = rw - crw.statusCode = rCode - return crw -} - -func releaseCRW(crw *customResponseWriter) { - crw.reset() - crwPool.Put(crw) -} - -func newContext() *ContextPayload { - return ctxPool.Get().(*ContextPayload) -} - -func releaseContext(cp *ContextPayload) { - cp.reset() - ctxPool.Put(cp) -} - -func releasePoolResources(crw *customResponseWriter, cp *ContextPayload) { - releaseCRW(crw) - releaseContext(cp) -} - -// NewRouter initializes & returns a new router instance with all the configurations and routes set -func NewRouter(cfg *Config, routes ...*Route) *Router { - r := &Router{ - NotFound: http.NotFound, - NotImplemented: func(rw http.ResponseWriter, req *http.Request) { - Send(rw, "", "501 Not Implemented", http.StatusNotImplemented) - }, - config: cfg, - } - - r.Add(routes...) - - return r -} - -// checkDuplicateRoutes checks if any of the routes have duplicate name or URI pattern -func checkDuplicateRoutes(idx int, route *Route, routes []*Route) { - // checking if the URI pattern is duplicated - for i := 0; i < idx; i++ { - rt := routes[i] - - if rt.Name == route.Name { - LOGHANDLER.Info( - fmt.Sprintf( - "Duplicate route name('%s') detected", - rt.Name, - ), - ) - } - - if rt.Method != route.Method { - continue - } - - // regex pattern match - if ok, _ := rt.matchPath(route.Pattern); !ok { - continue - } - - LOGHANDLER.Warn( - fmt.Sprintf( - "Duplicate URI pattern detected.\nPattern: '%s'\nDuplicate pattern: '%s'", - rt.Pattern, - route.Pattern, - ), - ) - LOGHANDLER.Warn("Only the first route to match the URI pattern would handle the request") - } -} - -// httpHandlers returns all the handlers in a map, for each HTTP method -func httpHandlers(routes []*Route) map[string][]*Route { - handlers := map[string][]*Route{} - - handlers[http.MethodHead] = []*Route{} - handlers[http.MethodGet] = []*Route{} - - for idx, route := range routes { - found := false - for _, validMethod := range validHTTPMethods { - if route.Method == validMethod { - found = true - break - } - } - - if !found { - LOGHANDLER.Fatal( - fmt.Sprintf( - "Unsupported HTTP method provided. Method: '%s'", - route.Method, - ), - ) - return nil - } - - if route.Handlers == nil || len(route.Handlers) == 0 { - LOGHANDLER.Fatal( - fmt.Sprintf( - "No handlers provided for the route '%s', method '%s'", - route.Pattern, - route.Method, - ), - ) - return nil - } - - err := route.init() - if err != nil { - LOGHANDLER.Fatal("Unsupported URI pattern.", route.Pattern, err) - return nil - } - - checkDuplicateRoutes(idx, route, routes) - - handlers[route.Method] = append(handlers[route.Method], route) - } - - return handlers -} diff --git a/vendor/github.com/bnkamalesh/webgo/v6/webgo.go b/vendor/github.com/bnkamalesh/webgo/v6/webgo.go deleted file mode 100644 index 0efa37b..0000000 --- a/vendor/github.com/bnkamalesh/webgo/v6/webgo.go +++ /dev/null @@ -1,187 +0,0 @@ -/* -Package webgo is a lightweight framework for building web apps. It has a multiplexer, -middleware plugging mechanism & context management of its own. The primary goal -of webgo is to get out of the developer's way as much as possible. i.e. it does -not enforce you to build your app in any particular pattern, instead just helps you -get all the trivial things done faster and easier. - -e.g. -1. Getting named URI parameters. -2. Multiplexer for regex matching of URI and such. -3. Inject special app level configurations or any such objects to the request context as required. -*/ -package webgo - -import ( - "context" - "crypto/tls" - "net/http" -) - -var supportedHTTPMethods = []string{ - http.MethodOptions, - http.MethodHead, - http.MethodGet, - http.MethodPost, - http.MethodPut, - http.MethodPatch, - http.MethodDelete, -} - -// ctxkey is a custom string type to store the WebGo context inside HTTP request context -type ctxkey string - -const wgoCtxKey = ctxkey("webgocontext") - -// ContextPayload is the WebgoContext. A new instance of ContextPayload is injected inside every request's context object -type ContextPayload struct { - Route *Route - Err error - URIParams map[string]string -} - -// Params returns the URI parameters of the respective route -func (cp *ContextPayload) Params() map[string]string { - return cp.URIParams -} - -func (cp *ContextPayload) reset() { - cp.Route = nil - cp.Err = nil -} - -// SetError sets the err within the context -func (cp *ContextPayload) SetError(err error) { - cp.Err = err -} - -// Error returns the error set within the context -func (cp *ContextPayload) Error() error { - return cp.Err -} - -// Context returns the ContextPayload injected inside the HTTP request context -func Context(r *http.Request) *ContextPayload { - return r.Context().Value(wgoCtxKey).(*ContextPayload) -} - -// SetError is a helper function to set the error in webgo context -func SetError(r *http.Request, err error) { - ctx := Context(r) - ctx.SetError(err) -} - -// GetError is a helper function to get the error from webgo context -func GetError(r *http.Request) error { - return Context(r).Error() -} - -// ResponseStatus returns the response status code. It works only if the http.ResponseWriter -// is not wrapped in another response writer before calling ResponseStatus -func ResponseStatus(rw http.ResponseWriter) int { - crw, ok := rw.(*customResponseWriter) - if !ok { - return http.StatusOK - } - return crw.statusCode -} - -// StartHTTPS starts the server with HTTPS enabled -func (router *Router) StartHTTPS() { - cfg := router.config - if cfg.CertFile == "" { - LOGHANDLER.Fatal("No certificate provided for HTTPS") - } - - if cfg.KeyFile == "" { - LOGHANDLER.Fatal("No key file provided for HTTPS") - } - - host := cfg.Host - if len(cfg.HTTPSPort) > 0 { - host += ":" + cfg.HTTPSPort - } - - router.httpsServer = &http.Server{ - Addr: host, - Handler: router, - ReadTimeout: cfg.ReadTimeout, - WriteTimeout: cfg.WriteTimeout, - TLSConfig: &tls.Config{ - InsecureSkipVerify: cfg.InsecureSkipVerify, - }, - } - - LOGHANDLER.Info("HTTPS server, listening on", host) - err := router.httpsServer.ListenAndServeTLS(cfg.CertFile, cfg.KeyFile) - if err != nil && err != http.ErrServerClosed { - LOGHANDLER.Error("HTTPS server exited with error:", err.Error()) - } -} - -// Start starts the HTTP server with the appropriate configurations -func (router *Router) Start() { - cfg := router.config - host := cfg.Host - - if len(cfg.Port) > 0 { - host += ":" + cfg.Port - } - - router.httpServer = &http.Server{ - Addr: host, - Handler: router, - ReadTimeout: cfg.ReadTimeout, - WriteTimeout: cfg.WriteTimeout, - } - LOGHANDLER.Info("HTTP server, listening on", host) - err := router.httpServer.ListenAndServe() - if err != nil && err != http.ErrServerClosed { - LOGHANDLER.Error("HTTP server exited with error:", err.Error()) - } -} - -// Shutdown gracefully shuts down HTTP server -func (router *Router) Shutdown() error { - if router.httpServer == nil { - return nil - } - timer := router.config.ShutdownTimeout - - ctx, cancel := context.WithTimeout(context.TODO(), timer) - defer cancel() - - err := router.httpServer.Shutdown(ctx) - if err != nil { - LOGHANDLER.Error(err) - } - return err -} - -// ShutdownHTTPS gracefully shuts down HTTPS server -func (router *Router) ShutdownHTTPS() error { - if router.httpsServer == nil { - return nil - } - timer := router.config.ShutdownTimeout - - ctx, cancel := context.WithTimeout(context.TODO(), timer) - defer cancel() - - err := router.httpsServer.Shutdown(ctx) - if err != nil && err != http.ErrServerClosed { - LOGHANDLER.Error(err) - } - return err -} - -// OriginalResponseWriter returns the Go response writer stored within the webgo custom response -// writer -func OriginalResponseWriter(rw http.ResponseWriter) http.ResponseWriter { - crw, ok := rw.(*customResponseWriter) - if !ok { - return nil - } - - return crw.ResponseWriter -} diff --git a/vendor/github.com/cespare/xxhash/v2/LICENSE.txt b/vendor/github.com/cespare/xxhash/v2/LICENSE.txt deleted file mode 100644 index 24b5306..0000000 --- a/vendor/github.com/cespare/xxhash/v2/LICENSE.txt +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2016 Caleb Spare - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/cespare/xxhash/v2/README.md b/vendor/github.com/cespare/xxhash/v2/README.md deleted file mode 100644 index 8bf0e5b..0000000 --- a/vendor/github.com/cespare/xxhash/v2/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# xxhash - -[![Go Reference](https://pkg.go.dev/badge/github.com/cespare/xxhash/v2.svg)](https://pkg.go.dev/github.com/cespare/xxhash/v2) -[![Test](https://github.com/cespare/xxhash/actions/workflows/test.yml/badge.svg)](https://github.com/cespare/xxhash/actions/workflows/test.yml) - -xxhash is a Go implementation of the 64-bit [xxHash] algorithm, XXH64. This is a -high-quality hashing algorithm that is much faster than anything in the Go -standard library. - -This package provides a straightforward API: - -``` -func Sum64(b []byte) uint64 -func Sum64String(s string) uint64 -type Digest struct{ ... } - func New() *Digest -``` - -The `Digest` type implements hash.Hash64. Its key methods are: - -``` -func (*Digest) Write([]byte) (int, error) -func (*Digest) WriteString(string) (int, error) -func (*Digest) Sum64() uint64 -``` - -The package is written with optimized pure Go and also contains even faster -assembly implementations for amd64 and arm64. If desired, the `purego` build tag -opts into using the Go code even on those architectures. - -[xxHash]: http://cyan4973.github.io/xxHash/ - -## Compatibility - -This package is in a module and the latest code is in version 2 of the module. -You need a version of Go with at least "minimal module compatibility" to use -github.com/cespare/xxhash/v2: - -* 1.9.7+ for Go 1.9 -* 1.10.3+ for Go 1.10 -* Go 1.11 or later - -I recommend using the latest release of Go. - -## Benchmarks - -Here are some quick benchmarks comparing the pure-Go and assembly -implementations of Sum64. - -| input size | purego | asm | -| ---------- | --------- | --------- | -| 4 B | 1.3 GB/s | 1.2 GB/s | -| 16 B | 2.9 GB/s | 3.5 GB/s | -| 100 B | 6.9 GB/s | 8.1 GB/s | -| 4 KB | 11.7 GB/s | 16.7 GB/s | -| 10 MB | 12.0 GB/s | 17.3 GB/s | - -These numbers were generated on Ubuntu 20.04 with an Intel Xeon Platinum 8252C -CPU using the following commands under Go 1.19.2: - -``` -benchstat <(go test -tags purego -benchtime 500ms -count 15 -bench 'Sum64$') -benchstat <(go test -benchtime 500ms -count 15 -bench 'Sum64$') -``` - -## Projects using this package - -- [InfluxDB](https://github.com/influxdata/influxdb) -- [Prometheus](https://github.com/prometheus/prometheus) -- [VictoriaMetrics](https://github.com/VictoriaMetrics/VictoriaMetrics) -- [FreeCache](https://github.com/coocood/freecache) -- [FastCache](https://github.com/VictoriaMetrics/fastcache) diff --git a/vendor/github.com/cespare/xxhash/v2/testall.sh b/vendor/github.com/cespare/xxhash/v2/testall.sh deleted file mode 100644 index 94b9c44..0000000 --- a/vendor/github.com/cespare/xxhash/v2/testall.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -eu -o pipefail - -# Small convenience script for running the tests with various combinations of -# arch/tags. This assumes we're running on amd64 and have qemu available. - -go test ./... -go test -tags purego ./... -GOARCH=arm64 go test -GOARCH=arm64 go test -tags purego diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash.go b/vendor/github.com/cespare/xxhash/v2/xxhash.go deleted file mode 100644 index a9e0d45..0000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash.go +++ /dev/null @@ -1,228 +0,0 @@ -// Package xxhash implements the 64-bit variant of xxHash (XXH64) as described -// at http://cyan4973.github.io/xxHash/. -package xxhash - -import ( - "encoding/binary" - "errors" - "math/bits" -) - -const ( - prime1 uint64 = 11400714785074694791 - prime2 uint64 = 14029467366897019727 - prime3 uint64 = 1609587929392839161 - prime4 uint64 = 9650029242287828579 - prime5 uint64 = 2870177450012600261 -) - -// Store the primes in an array as well. -// -// The consts are used when possible in Go code to avoid MOVs but we need a -// contiguous array of the assembly code. -var primes = [...]uint64{prime1, prime2, prime3, prime4, prime5} - -// Digest implements hash.Hash64. -type Digest struct { - v1 uint64 - v2 uint64 - v3 uint64 - v4 uint64 - total uint64 - mem [32]byte - n int // how much of mem is used -} - -// New creates a new Digest that computes the 64-bit xxHash algorithm. -func New() *Digest { - var d Digest - d.Reset() - return &d -} - -// Reset clears the Digest's state so that it can be reused. -func (d *Digest) Reset() { - d.v1 = primes[0] + prime2 - d.v2 = prime2 - d.v3 = 0 - d.v4 = -primes[0] - d.total = 0 - d.n = 0 -} - -// Size always returns 8 bytes. -func (d *Digest) Size() int { return 8 } - -// BlockSize always returns 32 bytes. -func (d *Digest) BlockSize() int { return 32 } - -// Write adds more data to d. It always returns len(b), nil. -func (d *Digest) Write(b []byte) (n int, err error) { - n = len(b) - d.total += uint64(n) - - memleft := d.mem[d.n&(len(d.mem)-1):] - - if d.n+n < 32 { - // This new data doesn't even fill the current block. - copy(memleft, b) - d.n += n - return - } - - if d.n > 0 { - // Finish off the partial block. - c := copy(memleft, b) - d.v1 = round(d.v1, u64(d.mem[0:8])) - d.v2 = round(d.v2, u64(d.mem[8:16])) - d.v3 = round(d.v3, u64(d.mem[16:24])) - d.v4 = round(d.v4, u64(d.mem[24:32])) - b = b[c:] - d.n = 0 - } - - if len(b) >= 32 { - // One or more full blocks left. - nw := writeBlocks(d, b) - b = b[nw:] - } - - // Store any remaining partial block. - copy(d.mem[:], b) - d.n = len(b) - - return -} - -// Sum appends the current hash to b and returns the resulting slice. -func (d *Digest) Sum(b []byte) []byte { - s := d.Sum64() - return append( - b, - byte(s>>56), - byte(s>>48), - byte(s>>40), - byte(s>>32), - byte(s>>24), - byte(s>>16), - byte(s>>8), - byte(s), - ) -} - -// Sum64 returns the current hash. -func (d *Digest) Sum64() uint64 { - var h uint64 - - if d.total >= 32 { - v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4 - h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4) - h = mergeRound(h, v1) - h = mergeRound(h, v2) - h = mergeRound(h, v3) - h = mergeRound(h, v4) - } else { - h = d.v3 + prime5 - } - - h += d.total - - b := d.mem[:d.n&(len(d.mem)-1)] - for ; len(b) >= 8; b = b[8:] { - k1 := round(0, u64(b[:8])) - h ^= k1 - h = rol27(h)*prime1 + prime4 - } - if len(b) >= 4 { - h ^= uint64(u32(b[:4])) * prime1 - h = rol23(h)*prime2 + prime3 - b = b[4:] - } - for ; len(b) > 0; b = b[1:] { - h ^= uint64(b[0]) * prime5 - h = rol11(h) * prime1 - } - - h ^= h >> 33 - h *= prime2 - h ^= h >> 29 - h *= prime3 - h ^= h >> 32 - - return h -} - -const ( - magic = "xxh\x06" - marshaledSize = len(magic) + 8*5 + 32 -) - -// MarshalBinary implements the encoding.BinaryMarshaler interface. -func (d *Digest) MarshalBinary() ([]byte, error) { - b := make([]byte, 0, marshaledSize) - b = append(b, magic...) - b = appendUint64(b, d.v1) - b = appendUint64(b, d.v2) - b = appendUint64(b, d.v3) - b = appendUint64(b, d.v4) - b = appendUint64(b, d.total) - b = append(b, d.mem[:d.n]...) - b = b[:len(b)+len(d.mem)-d.n] - return b, nil -} - -// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. -func (d *Digest) UnmarshalBinary(b []byte) error { - if len(b) < len(magic) || string(b[:len(magic)]) != magic { - return errors.New("xxhash: invalid hash state identifier") - } - if len(b) != marshaledSize { - return errors.New("xxhash: invalid hash state size") - } - b = b[len(magic):] - b, d.v1 = consumeUint64(b) - b, d.v2 = consumeUint64(b) - b, d.v3 = consumeUint64(b) - b, d.v4 = consumeUint64(b) - b, d.total = consumeUint64(b) - copy(d.mem[:], b) - d.n = int(d.total % uint64(len(d.mem))) - return nil -} - -func appendUint64(b []byte, x uint64) []byte { - var a [8]byte - binary.LittleEndian.PutUint64(a[:], x) - return append(b, a[:]...) -} - -func consumeUint64(b []byte) ([]byte, uint64) { - x := u64(b) - return b[8:], x -} - -func u64(b []byte) uint64 { return binary.LittleEndian.Uint64(b) } -func u32(b []byte) uint32 { return binary.LittleEndian.Uint32(b) } - -func round(acc, input uint64) uint64 { - acc += input * prime2 - acc = rol31(acc) - acc *= prime1 - return acc -} - -func mergeRound(acc, val uint64) uint64 { - val = round(0, val) - acc ^= val - acc = acc*prime1 + prime4 - return acc -} - -func rol1(x uint64) uint64 { return bits.RotateLeft64(x, 1) } -func rol7(x uint64) uint64 { return bits.RotateLeft64(x, 7) } -func rol11(x uint64) uint64 { return bits.RotateLeft64(x, 11) } -func rol12(x uint64) uint64 { return bits.RotateLeft64(x, 12) } -func rol18(x uint64) uint64 { return bits.RotateLeft64(x, 18) } -func rol23(x uint64) uint64 { return bits.RotateLeft64(x, 23) } -func rol27(x uint64) uint64 { return bits.RotateLeft64(x, 27) } -func rol31(x uint64) uint64 { return bits.RotateLeft64(x, 31) } diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s b/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s deleted file mode 100644 index 3e8b132..0000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s +++ /dev/null @@ -1,209 +0,0 @@ -//go:build !appengine && gc && !purego -// +build !appengine -// +build gc -// +build !purego - -#include "textflag.h" - -// Registers: -#define h AX -#define d AX -#define p SI // pointer to advance through b -#define n DX -#define end BX // loop end -#define v1 R8 -#define v2 R9 -#define v3 R10 -#define v4 R11 -#define x R12 -#define prime1 R13 -#define prime2 R14 -#define prime4 DI - -#define round(acc, x) \ - IMULQ prime2, x \ - ADDQ x, acc \ - ROLQ $31, acc \ - IMULQ prime1, acc - -// round0 performs the operation x = round(0, x). -#define round0(x) \ - IMULQ prime2, x \ - ROLQ $31, x \ - IMULQ prime1, x - -// mergeRound applies a merge round on the two registers acc and x. -// It assumes that prime1, prime2, and prime4 have been loaded. -#define mergeRound(acc, x) \ - round0(x) \ - XORQ x, acc \ - IMULQ prime1, acc \ - ADDQ prime4, acc - -// blockLoop processes as many 32-byte blocks as possible, -// updating v1, v2, v3, and v4. It assumes that there is at least one block -// to process. -#define blockLoop() \ -loop: \ - MOVQ +0(p), x \ - round(v1, x) \ - MOVQ +8(p), x \ - round(v2, x) \ - MOVQ +16(p), x \ - round(v3, x) \ - MOVQ +24(p), x \ - round(v4, x) \ - ADDQ $32, p \ - CMPQ p, end \ - JLE loop - -// func Sum64(b []byte) uint64 -TEXT ·Sum64(SB), NOSPLIT|NOFRAME, $0-32 - // Load fixed primes. - MOVQ ·primes+0(SB), prime1 - MOVQ ·primes+8(SB), prime2 - MOVQ ·primes+24(SB), prime4 - - // Load slice. - MOVQ b_base+0(FP), p - MOVQ b_len+8(FP), n - LEAQ (p)(n*1), end - - // The first loop limit will be len(b)-32. - SUBQ $32, end - - // Check whether we have at least one block. - CMPQ n, $32 - JLT noBlocks - - // Set up initial state (v1, v2, v3, v4). - MOVQ prime1, v1 - ADDQ prime2, v1 - MOVQ prime2, v2 - XORQ v3, v3 - XORQ v4, v4 - SUBQ prime1, v4 - - blockLoop() - - MOVQ v1, h - ROLQ $1, h - MOVQ v2, x - ROLQ $7, x - ADDQ x, h - MOVQ v3, x - ROLQ $12, x - ADDQ x, h - MOVQ v4, x - ROLQ $18, x - ADDQ x, h - - mergeRound(h, v1) - mergeRound(h, v2) - mergeRound(h, v3) - mergeRound(h, v4) - - JMP afterBlocks - -noBlocks: - MOVQ ·primes+32(SB), h - -afterBlocks: - ADDQ n, h - - ADDQ $24, end - CMPQ p, end - JG try4 - -loop8: - MOVQ (p), x - ADDQ $8, p - round0(x) - XORQ x, h - ROLQ $27, h - IMULQ prime1, h - ADDQ prime4, h - - CMPQ p, end - JLE loop8 - -try4: - ADDQ $4, end - CMPQ p, end - JG try1 - - MOVL (p), x - ADDQ $4, p - IMULQ prime1, x - XORQ x, h - - ROLQ $23, h - IMULQ prime2, h - ADDQ ·primes+16(SB), h - -try1: - ADDQ $4, end - CMPQ p, end - JGE finalize - -loop1: - MOVBQZX (p), x - ADDQ $1, p - IMULQ ·primes+32(SB), x - XORQ x, h - ROLQ $11, h - IMULQ prime1, h - - CMPQ p, end - JL loop1 - -finalize: - MOVQ h, x - SHRQ $33, x - XORQ x, h - IMULQ prime2, h - MOVQ h, x - SHRQ $29, x - XORQ x, h - IMULQ ·primes+16(SB), h - MOVQ h, x - SHRQ $32, x - XORQ x, h - - MOVQ h, ret+24(FP) - RET - -// func writeBlocks(d *Digest, b []byte) int -TEXT ·writeBlocks(SB), NOSPLIT|NOFRAME, $0-40 - // Load fixed primes needed for round. - MOVQ ·primes+0(SB), prime1 - MOVQ ·primes+8(SB), prime2 - - // Load slice. - MOVQ b_base+8(FP), p - MOVQ b_len+16(FP), n - LEAQ (p)(n*1), end - SUBQ $32, end - - // Load vN from d. - MOVQ s+0(FP), d - MOVQ 0(d), v1 - MOVQ 8(d), v2 - MOVQ 16(d), v3 - MOVQ 24(d), v4 - - // We don't need to check the loop condition here; this function is - // always called with at least one block of data to process. - blockLoop() - - // Copy vN back to d. - MOVQ v1, 0(d) - MOVQ v2, 8(d) - MOVQ v3, 16(d) - MOVQ v4, 24(d) - - // The number of bytes written is p minus the old base pointer. - SUBQ b_base+8(FP), p - MOVQ p, ret+32(FP) - - RET diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_arm64.s b/vendor/github.com/cespare/xxhash/v2/xxhash_arm64.s deleted file mode 100644 index 7e3145a..0000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_arm64.s +++ /dev/null @@ -1,183 +0,0 @@ -//go:build !appengine && gc && !purego -// +build !appengine -// +build gc -// +build !purego - -#include "textflag.h" - -// Registers: -#define digest R1 -#define h R2 // return value -#define p R3 // input pointer -#define n R4 // input length -#define nblocks R5 // n / 32 -#define prime1 R7 -#define prime2 R8 -#define prime3 R9 -#define prime4 R10 -#define prime5 R11 -#define v1 R12 -#define v2 R13 -#define v3 R14 -#define v4 R15 -#define x1 R20 -#define x2 R21 -#define x3 R22 -#define x4 R23 - -#define round(acc, x) \ - MADD prime2, acc, x, acc \ - ROR $64-31, acc \ - MUL prime1, acc - -// round0 performs the operation x = round(0, x). -#define round0(x) \ - MUL prime2, x \ - ROR $64-31, x \ - MUL prime1, x - -#define mergeRound(acc, x) \ - round0(x) \ - EOR x, acc \ - MADD acc, prime4, prime1, acc - -// blockLoop processes as many 32-byte blocks as possible, -// updating v1, v2, v3, and v4. It assumes that n >= 32. -#define blockLoop() \ - LSR $5, n, nblocks \ - PCALIGN $16 \ - loop: \ - LDP.P 16(p), (x1, x2) \ - LDP.P 16(p), (x3, x4) \ - round(v1, x1) \ - round(v2, x2) \ - round(v3, x3) \ - round(v4, x4) \ - SUB $1, nblocks \ - CBNZ nblocks, loop - -// func Sum64(b []byte) uint64 -TEXT ·Sum64(SB), NOSPLIT|NOFRAME, $0-32 - LDP b_base+0(FP), (p, n) - - LDP ·primes+0(SB), (prime1, prime2) - LDP ·primes+16(SB), (prime3, prime4) - MOVD ·primes+32(SB), prime5 - - CMP $32, n - CSEL LT, prime5, ZR, h // if n < 32 { h = prime5 } else { h = 0 } - BLT afterLoop - - ADD prime1, prime2, v1 - MOVD prime2, v2 - MOVD $0, v3 - NEG prime1, v4 - - blockLoop() - - ROR $64-1, v1, x1 - ROR $64-7, v2, x2 - ADD x1, x2 - ROR $64-12, v3, x3 - ROR $64-18, v4, x4 - ADD x3, x4 - ADD x2, x4, h - - mergeRound(h, v1) - mergeRound(h, v2) - mergeRound(h, v3) - mergeRound(h, v4) - -afterLoop: - ADD n, h - - TBZ $4, n, try8 - LDP.P 16(p), (x1, x2) - - round0(x1) - - // NOTE: here and below, sequencing the EOR after the ROR (using a - // rotated register) is worth a small but measurable speedup for small - // inputs. - ROR $64-27, h - EOR x1 @> 64-27, h, h - MADD h, prime4, prime1, h - - round0(x2) - ROR $64-27, h - EOR x2 @> 64-27, h, h - MADD h, prime4, prime1, h - -try8: - TBZ $3, n, try4 - MOVD.P 8(p), x1 - - round0(x1) - ROR $64-27, h - EOR x1 @> 64-27, h, h - MADD h, prime4, prime1, h - -try4: - TBZ $2, n, try2 - MOVWU.P 4(p), x2 - - MUL prime1, x2 - ROR $64-23, h - EOR x2 @> 64-23, h, h - MADD h, prime3, prime2, h - -try2: - TBZ $1, n, try1 - MOVHU.P 2(p), x3 - AND $255, x3, x1 - LSR $8, x3, x2 - - MUL prime5, x1 - ROR $64-11, h - EOR x1 @> 64-11, h, h - MUL prime1, h - - MUL prime5, x2 - ROR $64-11, h - EOR x2 @> 64-11, h, h - MUL prime1, h - -try1: - TBZ $0, n, finalize - MOVBU (p), x4 - - MUL prime5, x4 - ROR $64-11, h - EOR x4 @> 64-11, h, h - MUL prime1, h - -finalize: - EOR h >> 33, h - MUL prime2, h - EOR h >> 29, h - MUL prime3, h - EOR h >> 32, h - - MOVD h, ret+24(FP) - RET - -// func writeBlocks(d *Digest, b []byte) int -TEXT ·writeBlocks(SB), NOSPLIT|NOFRAME, $0-40 - LDP ·primes+0(SB), (prime1, prime2) - - // Load state. Assume v[1-4] are stored contiguously. - MOVD d+0(FP), digest - LDP 0(digest), (v1, v2) - LDP 16(digest), (v3, v4) - - LDP b_base+8(FP), (p, n) - - blockLoop() - - // Store updated state. - STP (v1, v2), 0(digest) - STP (v3, v4), 16(digest) - - BIC $31, n - MOVD n, ret+32(FP) - RET diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_asm.go b/vendor/github.com/cespare/xxhash/v2/xxhash_asm.go deleted file mode 100644 index 9216e0a..0000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_asm.go +++ /dev/null @@ -1,15 +0,0 @@ -//go:build (amd64 || arm64) && !appengine && gc && !purego -// +build amd64 arm64 -// +build !appengine -// +build gc -// +build !purego - -package xxhash - -// Sum64 computes the 64-bit xxHash digest of b. -// -//go:noescape -func Sum64(b []byte) uint64 - -//go:noescape -func writeBlocks(d *Digest, b []byte) int diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_other.go b/vendor/github.com/cespare/xxhash/v2/xxhash_other.go deleted file mode 100644 index 26df13b..0000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_other.go +++ /dev/null @@ -1,76 +0,0 @@ -//go:build (!amd64 && !arm64) || appengine || !gc || purego -// +build !amd64,!arm64 appengine !gc purego - -package xxhash - -// Sum64 computes the 64-bit xxHash digest of b. -func Sum64(b []byte) uint64 { - // A simpler version would be - // d := New() - // d.Write(b) - // return d.Sum64() - // but this is faster, particularly for small inputs. - - n := len(b) - var h uint64 - - if n >= 32 { - v1 := primes[0] + prime2 - v2 := prime2 - v3 := uint64(0) - v4 := -primes[0] - for len(b) >= 32 { - v1 = round(v1, u64(b[0:8:len(b)])) - v2 = round(v2, u64(b[8:16:len(b)])) - v3 = round(v3, u64(b[16:24:len(b)])) - v4 = round(v4, u64(b[24:32:len(b)])) - b = b[32:len(b):len(b)] - } - h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4) - h = mergeRound(h, v1) - h = mergeRound(h, v2) - h = mergeRound(h, v3) - h = mergeRound(h, v4) - } else { - h = prime5 - } - - h += uint64(n) - - for ; len(b) >= 8; b = b[8:] { - k1 := round(0, u64(b[:8])) - h ^= k1 - h = rol27(h)*prime1 + prime4 - } - if len(b) >= 4 { - h ^= uint64(u32(b[:4])) * prime1 - h = rol23(h)*prime2 + prime3 - b = b[4:] - } - for ; len(b) > 0; b = b[1:] { - h ^= uint64(b[0]) * prime5 - h = rol11(h) * prime1 - } - - h ^= h >> 33 - h *= prime2 - h ^= h >> 29 - h *= prime3 - h ^= h >> 32 - - return h -} - -func writeBlocks(d *Digest, b []byte) int { - v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4 - n := len(b) - for len(b) >= 32 { - v1 = round(v1, u64(b[0:8:len(b)])) - v2 = round(v2, u64(b[8:16:len(b)])) - v3 = round(v3, u64(b[16:24:len(b)])) - v4 = round(v4, u64(b[24:32:len(b)])) - b = b[32:len(b):len(b)] - } - d.v1, d.v2, d.v3, d.v4 = v1, v2, v3, v4 - return n - len(b) -} diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go b/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go deleted file mode 100644 index e86f1b5..0000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go +++ /dev/null @@ -1,16 +0,0 @@ -//go:build appengine -// +build appengine - -// This file contains the safe implementations of otherwise unsafe-using code. - -package xxhash - -// Sum64String computes the 64-bit xxHash digest of s. -func Sum64String(s string) uint64 { - return Sum64([]byte(s)) -} - -// WriteString adds more data to d. It always returns len(s), nil. -func (d *Digest) WriteString(s string) (n int, err error) { - return d.Write([]byte(s)) -} diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go b/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go deleted file mode 100644 index 1c1638f..0000000 --- a/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go +++ /dev/null @@ -1,58 +0,0 @@ -//go:build !appengine -// +build !appengine - -// This file encapsulates usage of unsafe. -// xxhash_safe.go contains the safe implementations. - -package xxhash - -import ( - "unsafe" -) - -// In the future it's possible that compiler optimizations will make these -// XxxString functions unnecessary by realizing that calls such as -// Sum64([]byte(s)) don't need to copy s. See https://go.dev/issue/2205. -// If that happens, even if we keep these functions they can be replaced with -// the trivial safe code. - -// NOTE: The usual way of doing an unsafe string-to-[]byte conversion is: -// -// var b []byte -// bh := (*reflect.SliceHeader)(unsafe.Pointer(&b)) -// bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data -// bh.Len = len(s) -// bh.Cap = len(s) -// -// Unfortunately, as of Go 1.15.3 the inliner's cost model assigns a high enough -// weight to this sequence of expressions that any function that uses it will -// not be inlined. Instead, the functions below use a different unsafe -// conversion designed to minimize the inliner weight and allow both to be -// inlined. There is also a test (TestInlining) which verifies that these are -// inlined. -// -// See https://github.com/golang/go/issues/42739 for discussion. - -// Sum64String computes the 64-bit xxHash digest of s. -// It may be faster than Sum64([]byte(s)) by avoiding a copy. -func Sum64String(s string) uint64 { - b := *(*[]byte)(unsafe.Pointer(&sliceHeader{s, len(s)})) - return Sum64(b) -} - -// WriteString adds more data to d. It always returns len(s), nil. -// It may be faster than Write([]byte(s)) by avoiding a copy. -func (d *Digest) WriteString(s string) (n int, err error) { - d.Write(*(*[]byte)(unsafe.Pointer(&sliceHeader{s, len(s)}))) - // d.Write always returns len(s), nil. - // Ignoring the return output and returning these fixed values buys a - // savings of 6 in the inliner's cost model. - return len(s), nil -} - -// sliceHeader is similar to reflect.SliceHeader, but it assumes that the layout -// of the first two words is the same as the layout of a string. -type sliceHeader struct { - s string - cap int -} diff --git a/vendor/github.com/dgryski/go-rendezvous/LICENSE b/vendor/github.com/dgryski/go-rendezvous/LICENSE deleted file mode 100644 index 22080f7..0000000 --- a/vendor/github.com/dgryski/go-rendezvous/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017-2020 Damian Gryski - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/dgryski/go-rendezvous/rdv.go b/vendor/github.com/dgryski/go-rendezvous/rdv.go deleted file mode 100644 index 7a6f820..0000000 --- a/vendor/github.com/dgryski/go-rendezvous/rdv.go +++ /dev/null @@ -1,79 +0,0 @@ -package rendezvous - -type Rendezvous struct { - nodes map[string]int - nstr []string - nhash []uint64 - hash Hasher -} - -type Hasher func(s string) uint64 - -func New(nodes []string, hash Hasher) *Rendezvous { - r := &Rendezvous{ - nodes: make(map[string]int, len(nodes)), - nstr: make([]string, len(nodes)), - nhash: make([]uint64, len(nodes)), - hash: hash, - } - - for i, n := range nodes { - r.nodes[n] = i - r.nstr[i] = n - r.nhash[i] = hash(n) - } - - return r -} - -func (r *Rendezvous) Lookup(k string) string { - // short-circuit if we're empty - if len(r.nodes) == 0 { - return "" - } - - khash := r.hash(k) - - var midx int - var mhash = xorshiftMult64(khash ^ r.nhash[0]) - - for i, nhash := range r.nhash[1:] { - if h := xorshiftMult64(khash ^ nhash); h > mhash { - midx = i + 1 - mhash = h - } - } - - return r.nstr[midx] -} - -func (r *Rendezvous) Add(node string) { - r.nodes[node] = len(r.nstr) - r.nstr = append(r.nstr, node) - r.nhash = append(r.nhash, r.hash(node)) -} - -func (r *Rendezvous) Remove(node string) { - // find index of node to remove - nidx := r.nodes[node] - - // remove from the slices - l := len(r.nstr) - r.nstr[nidx] = r.nstr[l] - r.nstr = r.nstr[:l] - - r.nhash[nidx] = r.nhash[l] - r.nhash = r.nhash[:l] - - // update the map - delete(r.nodes, node) - moved := r.nstr[nidx] - r.nodes[moved] = nidx -} - -func xorshiftMult64(x uint64) uint64 { - x ^= x >> 12 // a - x ^= x << 25 // b - x ^= x >> 27 // c - return x * 2685821657736338717 -} diff --git a/vendor/github.com/elastic/go-licenser/.gitignore b/vendor/github.com/elastic/go-licenser/.gitignore deleted file mode 100644 index 9148bfb..0000000 --- a/vendor/github.com/elastic/go-licenser/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -bin -testdata -dist diff --git a/vendor/github.com/elastic/go-licenser/.goreleaser.yml b/vendor/github.com/elastic/go-licenser/.goreleaser.yml deleted file mode 100644 index 4c9df9f..0000000 --- a/vendor/github.com/elastic/go-licenser/.goreleaser.yml +++ /dev/null @@ -1,32 +0,0 @@ -# This is an example goreleaser.yaml file with some sane defaults. -# Make sure to check the documentation at http://goreleaser.com -release: - github: - owner: elastic - name: go-licenser -builds: -- env: - - CGO_ENABLED=0 - ldflags: -s -w -X main.version={{.Env.VERSION }} -X main.commit={{.Commit}} - goos: - - linux - - darwin - - windows -archives: - - replacements: - darwin: Darwin - linux: Linux - windows: Windows - 386: i386 - amd64: x86_64 -checksum: - name_template: 'checksums.txt' -snapshot: - name_template: "{{ .Env.VERSION }}-SNAPSHOT-{{ .Commit }}" -dist: dist -changelog: - sort: asc - filters: - exclude: - - '^docs:' - - '^test:' diff --git a/vendor/github.com/elastic/go-licenser/CONTRIBUTING.md b/vendor/github.com/elastic/go-licenser/CONTRIBUTING.md deleted file mode 100644 index 0c8d15b..0000000 --- a/vendor/github.com/elastic/go-licenser/CONTRIBUTING.md +++ /dev/null @@ -1,47 +0,0 @@ -# Contributing - -Contributions are very welcome, this includes documentation, tutorials, bug reports, issues, feature requests, feature implementations, pull requests or simply organizing the repository issues. - -*Pull requests that contain changes on the code base **and** related documentation, e.g. for a new feature, shall remain a single, atomic one.* - -## Building From Source - -### Environment Prerequisites - -To install the latest changes directly from source code, you will need to have `go` installed with `$GOPATH` defined. If you need assistance with this please follow [golangbootcamp guide](http://www.golangbootcamp.com/book/get_setup#cha-get_setup). - -### Actual installation commands - -**Make sure you have followed through the environment requisites** - -```sh -go get -u github.com/elastic/go-licenser -``` - -## Reporting Issues - -If you have found an issue or defect in `go-licenser` or the latest documentation, use the GitHub [issue tracker](https://github.com/elastic/go-licenser/issues) to report the problem. Make sure to follow the template provided for you to provide all the useful details possible. - - -### Code Contribution Guidelines - -For the benefit of all, here are some recommendations with regards to your PR: - -* Go ahead and fork the project and make your changes. We encourage pull requests to allow for review and discussion of code changes. -* As a best practice it's best to open an Issue on the repository before submitting a PR. -* When you’re ready to create a pull request, be sure to: - * Sign your commit messages, see [DCO details](https://probot.github.io/apps/dco/) - * Have test cases for the new code. If you have questions about how to do this, please ask in your pull request. - * Run `make format` and `make lint`. - * Ensure that `make unit` succeeds. - - -### Golden Files - -If you're working with a function that relies on testdata or golden files, you might need to update those if your -change is modifying that logic. - -```console -$ make update-golden-files -ok github.com/elastic/go-licenser 0.029s -``` diff --git a/vendor/github.com/elastic/go-licenser/LICENSE b/vendor/github.com/elastic/go-licenser/LICENSE deleted file mode 100644 index 0d4ee75..0000000 --- a/vendor/github.com/elastic/go-licenser/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - 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 2018 Elasticsearch B.V. - - 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. diff --git a/vendor/github.com/elastic/go-licenser/Makefile b/vendor/github.com/elastic/go-licenser/Makefile deleted file mode 100644 index beee089..0000000 --- a/vendor/github.com/elastic/go-licenser/Makefile +++ /dev/null @@ -1,102 +0,0 @@ -export VERSION := v0.4.0 -export GO111MODULE ?= on -export GOBIN = $(shell pwd)/bin -OWNER ?= elastic -REPO ?= go-licenser -TEST_UNIT_FLAGS ?= -timeout 10s -p 4 -race -cover -TEST_UNIT_PACKAGE ?= ./... -GOLINT_PRESENT := $(shell command -v golint 2> /dev/null) -GOIMPORTS_PRESENT := $(shell command -v goimports 2> /dev/null) -RELEASED = $(shell git tag -l $(VERSION)) -DEFAULT_LDFLAGS ?= -X main.version=$(VERSION)-dev -X main.commit=$(shell git rev-parse HEAD) -include build/Makefile.deps - -define HELP -///////////////////////////////////////// -/\t$(REPO) Makefile \t\t/ -///////////////////////////////////////// - -## Build target - -- build: It will build $(REPO) for the current architecture in bin/$(REPO). -- install: It will install $(REPO) in the current system (by default in $(GOPATH)/bin/$(REPO)). - -## Development targets - -- deps: It will install the dependencies required to run developemtn targets. -- unit: Runs the unit tests. -- lint: Runs the linters. -- format: Formats the source files according to gofmt, goimports and go-licenser. -- update-golden-files: Updates the test golden files. - -## Release targets - -- release: Creates and publishes a new release matching the VERSION variable. -- snapshot: Creates a snapshot locally in the dist/ folder. - -endef -export HELP - -.DEFAULT: help -.PHONY: help -help: - @ echo "$$HELP" - -.PHONY: deps -deps: -ifndef GOLINT_PRESENT - @ go get -u golang.org/x/lint/golint -endif -ifndef GOIMPORTS_PRESENT - @ go get -u golang.org/x/tools/cmd/goimports -endif - -.PHONY: release_deps -release_deps: $(GOBIN)/goreleaser - -.PHONY: update-golden-files -update-golden-files: - $(eval GOLDEN_FILE_PACKAGES := "github.com/$(OWNER)/$(REPO)") - @ go test $(GOLDEN_FILE_PACKAGES) -update - -.PHONY: unit -unit: - @ go test $(TEST_UNIT_FLAGS) $(TEST_UNIT_PACKAGE) - -.PHONY: build -build: deps - @ go build -o bin/$(REPO) -ldflags="$(DEFAULT_LDFLAGS)" - -.PHONY: install -install: deps - @ go install - -.PHONY: lint -lint: build - @ $(GOBIN)/golint -set_exit_status $(shell go list ./...) - @ gofmt -d -e -s . - @ $(GOBIN)/go-licenser -d -exclude golden - -.PHONY: format -format: deps build - @ gofmt -e -w -s . - @ $(GOBIN)/goimports -w . - @ $(GOBIN)/go-licenser -exclude golden - -.PHONY: release -release: deps release_deps - @ echo "-> Releasing $(REPO) $(VERSION)..." - @ git fetch upstream -ifeq ($(strip $(RELEASED)),) - @ echo "-> Creating and pushing a new tag $(VERSION)..." - @ git tag $(VERSION) - @ git push upstream $(VERSION) - @ $(GOBIN)/goreleaser release --skip-validate --rm-dist -else - @ echo "-> git tag $(VERSION) already present, skipping release..." -endif - -.PHONY: snapshot -snapshot: deps release_deps - @ echo "-> Snapshotting $(REPO) $(VERSION)..." - @ $(GOBIN)/goreleaser release --snapshot --rm-dist diff --git a/vendor/github.com/elastic/go-licenser/NOTICE b/vendor/github.com/elastic/go-licenser/NOTICE deleted file mode 100644 index 4972cec..0000000 --- a/vendor/github.com/elastic/go-licenser/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -Elastic go-licenser -Copyright 2018 Elasticsearch B.V. - -This product includes software developed at -Elasticsearch, B.V. (https://www.elastic.co/). diff --git a/vendor/github.com/elastic/go-licenser/README.md b/vendor/github.com/elastic/go-licenser/README.md deleted file mode 100644 index 9453fab..0000000 --- a/vendor/github.com/elastic/go-licenser/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# Go Licenser [![Build Status](https://beats-ci.elastic.co/job/Library/job/go-licenser-mbp/job/main/badge/icon)](https://beats-ci.elastic.co/job/Library/job/go-licenser-mbp/job/main/) - -Small zero dependency license header checker for source files. The aim of this project is to provide a common -binary that can be used to ensure that code source files contain a license header. It's unlikely that this project -is useful outside of Elastic **_at the current stage_**, but the `licensing` package can be used as a building block. - -## Supported Licenses - -* Apache 2.0 -* Elastic -* Elastic 2.0 -* Elastic Cloud - -## Supported languages - -* Go - -## Installing - -``` -go get -u github.com/elastic/go-licenser -``` - -## Usage - -``` -Usage: go-licenser [flags] [path] - - go-licenser walks the specified path recursively and appends a license Header if the current - header doesn't match the one found in the file. - -Options: - - -d skips rewriting files and returns exitcode 1 if any discrepancies are found. - -exclude value - path to exclude (can be specified multiple times). - -ext string - sets the file extension to scan for. (default ".go") - -license string - sets the license type to check: ASL2, ASL2-Short, Cloud, Elastic, Elasticv2 (default "ASL2") - -licensor string - sets the name of the licensor (default "Elasticsearch B.V.") - -version - prints out the binary version. -``` - -## Contributing - -See [CONTRIBUTING.md](./CONTRIBUTING.md). - diff --git a/vendor/github.com/elastic/go-licenser/appveyor.yml b/vendor/github.com/elastic/go-licenser/appveyor.yml deleted file mode 100644 index aea89da..0000000 --- a/vendor/github.com/elastic/go-licenser/appveyor.yml +++ /dev/null @@ -1,32 +0,0 @@ -version: "{build}" - -image: Visual Studio 2019 - -# Source Config - -clone_folder: c:\gopath\src\github.com\elastic\go-licenser - -# Build host - -environment: - CGO_ENABLED: 0 -stack: go 1.17 - -# Build - -install: - - choco install bzr - - set Path=C:\Users\appveyor\go\bin;C:\Program Files (x86)\Bazaar\;C:\Program Files\Mercurial\%Path% - - go version - - go env - -before_build: - - go install - -build_script: - - appveyor AddCompilationMessage "Starting Compilation" - - go install github.com/elastic/go-licenser - -test_script: - - go-licenser -d -exclude golden - - go test -timeout 10s -p 4 -cover ./... diff --git a/vendor/github.com/elastic/go-licenser/error.go b/vendor/github.com/elastic/go-licenser/error.go deleted file mode 100644 index 5c40faa..0000000 --- a/vendor/github.com/elastic/go-licenser/error.go +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 main - -// Error wraps a normal error with an Exitcode. -type Error struct { - err error - code int -} - -func (e Error) Error() string { - if e.err != nil { - return e.err.Error() - } - return "" -} - -// Code returns the exitcode for the error -func Code(e error) int { - if err, ok := e.(*Error); ok { - return err.code - } - return 0 -} diff --git a/vendor/github.com/elastic/go-licenser/licensing/doc.go b/vendor/github.com/elastic/go-licenser/licensing/doc.go deleted file mode 100644 index 3fcc1ac..0000000 --- a/vendor/github.com/elastic/go-licenser/licensing/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 licensing provides a set of functions that read the top -// lines of a file and can determine if they match a specific header. -package licensing diff --git a/vendor/github.com/elastic/go-licenser/licensing/license.go b/vendor/github.com/elastic/go-licenser/licensing/license.go deleted file mode 100644 index 97e6724..0000000 --- a/vendor/github.com/elastic/go-licenser/licensing/license.go +++ /dev/null @@ -1,132 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 licensing - -import ( - "bufio" - "bytes" - "errors" - "io" - "io/ioutil" - "os" - "reflect" - "strings" -) - -var ( - startPrefixes = []string{"// Copyright", "// copyright", "// Licensed", "// licensed", "// ELASTICSEARCH CONFIDENTIAL"} - endPrefixes = []string{"package ", "// Package ", "// +build ", "// Code generated", "// code generated"} - - errHeaderIsTooShort = errors.New("header is too short") -) - -// ContainsHeader reads the first N lines of a file and checks if the header -// matches the one that is expected -func ContainsHeader(r io.Reader, headerLines []string) bool { - var found []string - var scanner = bufio.NewScanner(r) - - for scanner.Scan() { - found = append(found, scanner.Text()) - } - - if len(found) < len(headerLines) { - return false - } - - if !reflect.DeepEqual(found[:len(headerLines)], headerLines) { - return false - } - - return true -} - -// RewriteFileWithHeader reads a file from a path and rewrites it with a header -func RewriteFileWithHeader(path string, header []byte) error { - if len(header) < 2 { - return errHeaderIsTooShort - } - - info, err := os.Stat(path) - if err != nil { - return err - } - - origin, err := ioutil.ReadFile(path) - if err != nil { - return err - } - - data := RewriteWithHeader(origin, header) - return ioutil.WriteFile(path, data, info.Mode()) -} - -// RewriteWithHeader rewrites the src byte buffers header with the new header. -func RewriteWithHeader(src []byte, header []byte) []byte { - // Ensures that the header includes two break lines as the last bytes - for !reflect.DeepEqual(header[len(header)-2:], []byte("\n\n")) { - header = append(header, []byte("\n")...) - } - - var oldHeader = headerBytes(bytes.NewReader(src)) - return bytes.Replace(src, oldHeader, header, 1) -} - -// headerBytes detects the header lines of an io.Reader contents and returns -// what it considerst to be the header as a slice of bytes. -func headerBytes(r io.Reader) []byte { - var scanner = bufio.NewScanner(r) - var replaceableHeader []byte - var continuedHeader bool - for scanner.Scan() { - var t = scanner.Text() - - for i := range endPrefixes { - if strings.HasPrefix(t, endPrefixes[i]) { - return replaceableHeader - } - } - - for i := range startPrefixes { - if strings.HasPrefix(t, startPrefixes[i]) { - continuedHeader = true - } - } - - if continuedHeader { - replaceableHeader = append(replaceableHeader, []byte(t+"\n")...) - } - } - - return replaceableHeader -} - -// containsHeaderLine reads the first N lines of a file and checks if the header -// matches the one that is expected -func containsHeaderLine(r io.Reader, headerLines []string) bool { - var scanner = bufio.NewScanner(r) - for scanner.Scan() { - for i := range headerLines { - if scanner.Text() == headerLines[i] { - return true - } - } - } - - return false -} diff --git a/vendor/github.com/elastic/go-licenser/main.go b/vendor/github.com/elastic/go-licenser/main.go deleted file mode 100644 index ff478cc..0000000 --- a/vendor/github.com/elastic/go-licenser/main.go +++ /dev/null @@ -1,277 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 main - -import ( - "flag" - "fmt" - "io" - "os" - "path/filepath" - "sort" - "strings" - - "github.com/elastic/go-licenser/licensing" -) - -const ( - defaultExt = ".go" - defaultPath = "." - defaultLicense = "ASL2" - defaultLicensor = "Elasticsearch B.V." - defaultFormat = "%s: is missing the license header\n" -) - -const ( - exitDefault = iota - exitSourceNeedsToBeRewritten - exitFailedToStatTree - exitFailedToStatFile - exitFailedToWalkPath - exitFailedToOpenWalkFile - errFailedRewrittingFile - errUnknownLicense -) - -var usageText = ` -Usage: go-licenser [flags] [path] - - go-licenser walks the specified path recursively and appends a license Header if the current - header doesn't match the one found in the file. - -Options: - -`[1:] - -// Headers is the map of supported licenses -var Headers = map[string][]string{ - "ASL2": { - `// Licensed to %s under one or more contributor`, - `// license agreements. See the NOTICE file distributed with`, - `// this work for additional information regarding copyright`, - `// ownership. %s 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.`, - }, - "ASL2-Short": { - `// Licensed to %s under one or more agreements.`, - `// %s licenses this file to you under the Apache 2.0 License.`, - `// See the LICENSE file in the project root for more information.`, - }, - "Elastic": { - `// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one`, - `// or more contributor license agreements. Licensed under the Elastic License;`, - `// you may not use this file except in compliance with the Elastic License.`, - }, - "Elasticv2": { - `// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one`, - `// or more contributor license agreements. Licensed under the Elastic License 2.0;`, - `// you may not use this file except in compliance with the Elastic License 2.0.`, - }, - "Cloud": { - `// ELASTICSEARCH CONFIDENTIAL`, - `// __________________`, - `//`, - `// Copyright Elasticsearch B.V. All rights reserved.`, - `//`, - `// NOTICE: All information contained herein is, and remains`, - `// the property of Elasticsearch B.V. and its suppliers, if any.`, - `// The intellectual and technical concepts contained herein`, - `// are proprietary to Elasticsearch B.V. and its suppliers and`, - `// may be covered by U.S. and Foreign Patents, patents in`, - `// process, and are protected by trade secret or copyright`, - `// law. Dissemination of this information or reproduction of`, - `// this material is strictly forbidden unless prior written`, - `// permission is obtained from Elasticsearch B.V.`, - }, -} - -var ( - dryRun bool - showVersion bool - extension string - args []string - license string - licensor string - exclude sliceFlag - defaultExludedDirs = []string{"vendor", ".git"} -) - -type sliceFlag []string - -func (f *sliceFlag) String() string { - var s string - for _, i := range *f { - s += i + " " - } - return s -} - -func (f *sliceFlag) Set(value string) error { - *f = append(*f, value) - return nil -} - -func initFlags() { - var licenseTypes []string - for k := range Headers { - licenseTypes = append(licenseTypes, k) - } - sort.Strings(licenseTypes) - - flag.Var(&exclude, "exclude", `path to exclude (can be specified multiple times).`) - flag.BoolVar(&dryRun, "d", false, `skips rewriting files and returns exitcode 1 if any discrepancies are found.`) - flag.BoolVar(&showVersion, "version", false, `prints out the binary version.`) - flag.StringVar(&extension, "ext", defaultExt, "sets the file extension to scan for.") - flag.StringVar(&license, "license", defaultLicense, fmt.Sprintf("sets the license type to check: %s", strings.Join(licenseTypes, ", "))) - flag.StringVar(&licensor, "licensor", defaultLicensor, "sets the name of the licensor") - flag.Usage = usageFlag - flag.Parse() - args = flag.Args() -} - -func main() { - initFlags() - - if showVersion { - fmt.Printf("go-licenser %s (%s)\n", version, commit) - return - } - - err := run(args, license, licensor, exclude, extension, dryRun, os.Stdout) - if err != nil && err.Error() != "" { - fmt.Fprint(os.Stderr, err) - } - - os.Exit(Code(err)) -} - -func run(args []string, license, licensor string, exclude []string, ext string, dry bool, out io.Writer) error { - header, ok := Headers[license] - if !ok { - return &Error{err: fmt.Errorf("unknown license: %s", license), code: errUnknownLicense} - } - - var headerBytes []byte - for i, line := range header { - if strings.Contains(line, "%s") { - header[i] = fmt.Sprintf(line, licensor) - } - headerBytes = append(headerBytes, []byte(header[i])...) - headerBytes = append(headerBytes, []byte("\n")...) - } - - var path = defaultPath - if len(args) > 0 { - path = args[0] - } - - if _, err := os.Stat(path); err != nil { - return &Error{err: err, code: exitFailedToStatTree} - } - - return walk(path, ext, license, headerBytes, exclude, dry, out) -} - -func reportFile(out io.Writer, f string) { - cwd, _ := filepath.Abs(filepath.Dir(os.Args[0])) - rel, err := filepath.Rel(cwd, f) - if err != nil { - rel = f - } - fmt.Fprintf(out, defaultFormat, rel) -} - -func walk(p, ext, license string, headerBytes []byte, exclude []string, dry bool, out io.Writer) error { - var err error - filepath.Walk(p, func(path string, info os.FileInfo, walkErr error) error { - if walkErr != nil { - err = &Error{err: walkErr, code: exitFailedToWalkPath} - return walkErr - } - - var currentPath = cleanPathPrefixes( - strings.TrimLeft(path, p), - []string{string(os.PathSeparator)}, - ) - - var excludedDir = info.IsDir() && stringInSlice(info.Name(), defaultExludedDirs) - if needsExclusion(currentPath, exclude) || excludedDir { - return filepath.SkipDir - } - - if e := addOrCheckLicense(path, ext, license, headerBytes, info, dry, out); e != nil { - err = e - } - - return nil - }) - - return err -} - -func addOrCheckLicense(path, ext, license string, headerBytes []byte, info os.FileInfo, dry bool, out io.Writer) error { - if info.IsDir() || filepath.Ext(path) != ext { - return nil - } - - f, e := os.Open(path) - if e != nil { - return &Error{err: e, code: exitFailedToOpenWalkFile} - } - defer f.Close() - - if licensing.ContainsHeader(f, Headers[license]) { - return nil - } - - if dry { - reportFile(out, path) - return &Error{code: exitSourceNeedsToBeRewritten} - } - - if err := licensing.RewriteFileWithHeader(path, headerBytes); err != nil { - return &Error{err: err, code: errFailedRewrittingFile} - } - - return nil -} - -func stringInSlice(a string, list []string) bool { - for _, b := range list { - if b == a { - return true - } - } - return false -} - -func usageFlag() { - fmt.Fprintf(os.Stderr, usageText) - flag.PrintDefaults() -} diff --git a/vendor/github.com/elastic/go-licenser/path.go b/vendor/github.com/elastic/go-licenser/path.go deleted file mode 100644 index fad555b..0000000 --- a/vendor/github.com/elastic/go-licenser/path.go +++ /dev/null @@ -1,54 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 main - -import ( - "os" - "strings" -) - -func needsExclusion(path string, exclude []string) bool { - for _, excluded := range exclude { - excluded = cleanPathSuffixes(excluded, []string{"*", string(os.PathSeparator)}) - if strings.HasPrefix(path, excluded) { - return true - } - } - - return false -} - -func cleanPathSuffixes(path string, sufixes []string) string { - for _, suffix := range sufixes { - for strings.HasSuffix(path, suffix) && len(path) > 0 { - path = path[:len(path)-len(suffix)] - } - } - - return path -} - -func cleanPathPrefixes(path string, prefixes []string) string { - for _, prefix := range prefixes { - for strings.HasPrefix(path, prefix) && len(path) > 0 { - path = path[len(prefix):] - } - } - - return path -} diff --git a/vendor/github.com/elastic/go-licenser/testhelpers.go b/vendor/github.com/elastic/go-licenser/testhelpers.go deleted file mode 100644 index 37b25b9..0000000 --- a/vendor/github.com/elastic/go-licenser/testhelpers.go +++ /dev/null @@ -1,151 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 main - -import ( - "bytes" - "crypto/sha1" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "runtime" - "strings" - "syscall" - "testing" -) - -const fixtures = "fixtures" - -func copyFixtures(t *testing.T, dest string) func() { - if err := copy(fixtures, dest); err != nil { - t.Fatal(err) - } - return func() { - if err := os.RemoveAll(dest); err != nil { - t.Fatal(err) - } - } -} - -func copy(src, dest string) error { - info, err := os.Stat(src) - if err != nil { - return err - } - if info.IsDir() { - return dcopy(src, dest, info) - } - return fcopy(src, dest, info) -} - -func fcopy(src, dest string, info os.FileInfo) error { - f, err := os.Create( - strings.Replace(dest, ".testdata", ".go", 1), - ) - if err != nil { - return err - } - defer f.Close() - - if err = os.Chmod(f.Name(), info.Mode()); err != nil { - return err - } - - s, err := os.Open(src) - if err != nil { - return err - } - defer s.Close() - - _, err = io.Copy(f, s) - return err -} - -func dcopy(src, dest string, info os.FileInfo) error { - if err := os.MkdirAll(dest, info.Mode()); err != nil { - return err - } - - infs, err := ioutil.ReadDir(src) - if err != nil { - return err - } - - for i := range infs { - var source = filepath.Join(src, infs[i].Name()) - var destination = filepath.Join(dest, infs[i].Name()) - if err := copy(source, destination); err != nil { - return err - } - } - - return nil -} - -func hashDirectories(t *testing.T, src, dest string) { - var srcHash = sha1.New() - var dstHash = sha1.New() - t.Logf("===== Walking %s =====\n", src) - if err := filepath.Walk(src, func(path string, info os.FileInfo, err error) error { - if err != nil || path == src { - return nil - } - - t.Log(fmt.Sprint(info.Name(), " => ", info.Size())) - io.WriteString(srcHash, fmt.Sprint(info.Name(), info.Size())) - return nil - }); err != nil { - t.Fatal(err) - } - - t.Logf("===== Walking %s =====\n", dest) - if err := filepath.Walk(dest, func(path string, info os.FileInfo, err error) error { - if err != nil || path == dest { - return nil - } - - t.Log(fmt.Sprint(info.Name(), " => ", info.Size())) - io.WriteString(dstHash, fmt.Sprint(info.Name(), info.Size())) - return nil - }); err != nil { - t.Fatal(err) - } - - t.Log("===========================") - var srcSum, dstSum = srcHash.Sum(nil), dstHash.Sum(nil) - if bytes.Compare(srcSum, dstSum) != 0 { - t.Errorf("Contents of %s are not the same as %s", src, dest) - t.Errorf("src folder hash: %x", srcSum) - t.Errorf("dst folder hash: %x", dstSum) - } -} - -func goosPathError(code int, p string) error { - var opName = "stat" - if runtime.GOOS == "windows" { - opName = "CreateFile" - } - - return &Error{code: code, err: &os.PathError{ - Op: opName, - Path: p, - Err: syscall.ENOENT, - }} -} diff --git a/vendor/github.com/elastic/go-licenser/version.go b/vendor/github.com/elastic/go-licenser/version.go deleted file mode 100644 index 426d123..0000000 --- a/vendor/github.com/elastic/go-licenser/version.go +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 main - -var ( - version string - commit string -) diff --git a/vendor/github.com/elastic/go-sysinfo/.editorconfig b/vendor/github.com/elastic/go-sysinfo/.editorconfig deleted file mode 100644 index 8cc16d1..0000000 --- a/vendor/github.com/elastic/go-sysinfo/.editorconfig +++ /dev/null @@ -1,27 +0,0 @@ -# See: http://editorconfig.org -root = true - -[*] -charset = utf-8 -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true - -[*.json] -indent_size = 2 -indent_style = space - -[*.py] -indent_style = space -indent_size = 4 - -[*.yml] -indent_style = space -indent_size = 2 - -[Makefile] -indent_style = tab - -[Vagrantfile] -indent_size = 2 -indent_style = space diff --git a/vendor/github.com/elastic/go-sysinfo/.gitattributes b/vendor/github.com/elastic/go-sysinfo/.gitattributes deleted file mode 100644 index 875f499..0000000 --- a/vendor/github.com/elastic/go-sysinfo/.gitattributes +++ /dev/null @@ -1,5 +0,0 @@ -# Treat all files in the Go repo as binary, with no git magic updating -# line endings. Windows users contributing to Go will need to use a -# modern version of git and editors capable of LF line endings. - -* -text diff --git a/vendor/github.com/elastic/go-sysinfo/.gitignore b/vendor/github.com/elastic/go-sysinfo/.gitignore deleted file mode 100644 index f3827eb..0000000 --- a/vendor/github.com/elastic/go-sysinfo/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.iml -*.swp -*.o -.idea -.vagrant -_obj - -*TEST.out -main.retry -testing/ssh_config -testing/ve - -build/ \ No newline at end of file diff --git a/vendor/github.com/elastic/go-sysinfo/CHANGELOG.md b/vendor/github.com/elastic/go-sysinfo/CHANGELOG.md deleted file mode 100644 index 4e32864..0000000 --- a/vendor/github.com/elastic/go-sysinfo/CHANGELOG.md +++ /dev/null @@ -1,165 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -### Added - -### Changed - -### Deprecated - -### Removed - -### Fixed - -## [1.9.0] - -### Added - -- Replace pkg/errors with Go 1.13 native errors. [#123](https://github.com/elastic/go-sysinfo/pull/123) -- Add OS family mappings for `rocky`, `openEuler`, and `almalinux`. [#143](https://github.com/elastic/go-sysinfo/pull/143) - -### Changed - -- Remove custom sysctl implementation and partial cgo requirement. [#135](https://github.com/elastic/go-sysinfo/pull/135) -- Changes on the `Host` and `LoadAverage` interfaces, now implemented by default on Linux and Darwin platforms. [#140](https://github.com/elastic/go-sysinfo/pull/140) - -## [1.8.1] - -### Fixed - -- Report OS name as Windows 11 when version is >= 10.0.22000. [#118](https://github.com/elastic/go-sysinfo/issues/118) [#121](https://github.com/elastic/go-sysinfo/pull/121) - -## [1.8.0] - -### Added - -- Added the Oracle Linux ("ol") platform to the "redhat" OS family. [#54](https://github.com/elastic/go-sysinfo/issues/54) [#115](https://github.com/elastic/go-sysinfo/pull/115) -- Added the Linux Mint ("linuxmint") platform to the "debian" OS family. [#52](https://github.com/elastic/go-sysinfo/issues/52) - -### Changed - -- Updated module to require Go 1.17. [#111](https://github.com/elastic/go-sysinfo/pull/111) -- The boot time value for Windows is now rounded to the nearest second to provide a more stable value. [#53](https://github.com/elastic/go-sysinfo/issues/53) [#114](https://github.com/elastic/go-sysinfo/pull/114) - -### Fixed - -- Fix handling of environment variables without values on macOS. [#94](https://github.com/elastic/go-sysinfo/pull/94) -- Fix build tags on AIX provider such that CGO is required. [#106](https://github.com/elastic/go-sysinfo/issues/106) - -## [1.7.1] - 2021-10-11 - -### Fixed - -- Fixed getting OS info when an unsupported file or directory is found matching /etc/\*-release [#102](https://github.com/elastic/go-sysinfo/pull/102) - -## [1.7.0] - 2021-02-22 - -### Added - -- Add per-process network stats [#96](https://github.com/elastic/go-sysinfo/pull/96) - -## [1.6.0] - 2021-02-09 - -### Added - -- Add darwin/arm64 support (Apple M1). [#91](https://github.com/elastic/go-sysinfo/pull/91) - -## [1.5.0] - 2021-01-14 - -### Added - -- Added os.type field to host info. [#87](https://github.com/elastic/go-sysinfo/pull/87) - -## [1.4.0] - 2020-07-21 - -### Added - -- Add AIX support [#77](https://github.com/elastic/go-sysinfo/pull/77) -- Added detection of containerized cgroup in Kubernetes [#80](https://github.com/elastic/go-sysinfo/pull/80) - -## [1.3.0] - 2020-01-13 - -### Changed - -- Convert NetworkCountersInfo maps to uint64 [#75](https://github.com/elastic/go-sysinfo/pull/75) - -## [1.2.1] - 2020-01-03 - -### Fixed - -- Create a `sidToString` function to deal with API changes in various versions of golang.org/x/sys/windows. [#74](https://github.com/elastic/go-sysinfo/pull/74) - -## [1.2.0] - 2019-12-09 - -### Added - -- Added detection of systemd cgroups to the `IsContainerized` check. [#71](https://github.com/elastic/go-sysinfo/pull/71) -- Added networking counters for Linux hosts. [#72](https://github.com/elastic/go-sysinfo/pull/72) - -## [1.1.1] - 2019-10-29 - -### Fixed - -- Fixed an issue determining the Linux distribution for Fedora 30. [#69](https://github.com/elastic/go-sysinfo/pull/69) - -## [1.1.0] - 2019-08-22 - -### Added - -- Add `VMStat` interface for Linux. [#59](https://github.com/elastic/go-sysinfo/pull/59) - -## [1.0.2] - 2019-07-09 - -### Fixed - -- Fixed a leak when calling the CommandLineToArgv function. [#51](https://github.com/elastic/go-sysinfo/pull/51) -- Fixed a crash when calling the CommandLineToArgv function. [#58](https://github.com/elastic/go-sysinfo/pull/58) - -## [1.0.1] - 2019-05-08 - -### Fixed - -- Add support for new prometheus/procfs API. [#49](https://github.com/elastic/go-sysinfo/pull/49) - -## [1.0.0] - 2019-05-03 - -### Added - -- Add Windows provider implementation. [#22](https://github.com/elastic/go-sysinfo/pull/22) -- Add Windows process provider. [#26](https://github.com/elastic/go-sysinfo/pull/26) -- Add `OpenHandleEnumerator` and `OpenHandleCount` and implement these for Windows. [#27](https://github.com/elastic/go-sysinfo/pull/27) -- Add user info to Process. [#34](https://github.com/elastic/go-sysinfo/pull/34) -- Implement `Processes` for Darwin. [#35](https://github.com/elastic/go-sysinfo/pull/35) -- Add `Parent()` to `Process`. [#46](https://github.com/elastic/go-sysinfo/pull/46) - -### Fixed - -- Fix Windows registry handle leak. [#33](https://github.com/elastic/go-sysinfo/pull/33) -- Fix Linux host ID by search for older locations for the machine-id file. [#44](https://github.com/elastic/go-sysinfo/pull/44) - -### Changed - -- Changed the host containerized check to reduce false positives. [#42](https://github.com/elastic/go-sysinfo/pull/42) [#43](https://github.com/elastic/go-sysinfo/pull/43) - -[Unreleased]: https://github.com/elastic/go-sysinfo/compare/v1.8.1...HEAD -[1.8.1]: https://github.com/elastic/go-sysinfo/releases/tag/v1.8.1 -[1.8.0]: https://github.com/elastic/go-sysinfo/releases/tag/v1.8.0 -[1.7.1]: https://github.com/elastic/go-sysinfo/releases/tag/v1.7.1 -[1.7.0]: https://github.com/elastic/go-sysinfo/releases/tag/v1.7.0 -[1.6.0]: https://github.com/elastic/go-sysinfo/releases/tag/v1.6.0 -[1.5.0]: https://github.com/elastic/go-sysinfo/releases/tag/v1.5.0 -[1.4.0]: https://github.com/elastic/go-sysinfo/releases/tag/v1.4.0 -[1.3.0]: https://github.com/elastic/go-sysinfo/releases/tag/v1.3.0 -[1.2.1]: https://github.com/elastic/go-sysinfo/releases/tag/v1.2.1 -[1.2.0]: https://github.com/elastic/go-sysinfo/releases/tag/v1.2.0 -[1.1.1]: https://github.com/elastic/go-sysinfo/releases/tag/v1.1.0 -[1.1.0]: https://github.com/elastic/go-sysinfo/releases/tag/v1.1.0 -[1.0.2]: https://github.com/elastic/go-sysinfo/releases/tag/v1.0.2 -[1.0.1]: https://github.com/elastic/go-sysinfo/releases/tag/v1.0.1 -[1.0.0]: https://github.com/elastic/go-sysinfo/releases/tag/v1.0.0 diff --git a/vendor/github.com/elastic/go-sysinfo/LICENSE.txt b/vendor/github.com/elastic/go-sysinfo/LICENSE.txt deleted file mode 100644 index d645695..0000000 --- a/vendor/github.com/elastic/go-sysinfo/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - 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. diff --git a/vendor/github.com/elastic/go-sysinfo/Makefile b/vendor/github.com/elastic/go-sysinfo/Makefile deleted file mode 100644 index 9d4e6b1..0000000 --- a/vendor/github.com/elastic/go-sysinfo/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -.phony: update -update: fmt lic imports - -.PHONY: lic -lic: - go run github.com/elastic/go-licenser@latest - -.PHONY: fmt -fmt: - go run mvdan.cc/gofumpt@latest -w -l ./ - -.PHONY: imports -imports: - go run golang.org/x/tools/cmd/goimports@latest -l -local github.com/elastic/go-sysinfo ./ diff --git a/vendor/github.com/elastic/go-sysinfo/NOTICE.txt b/vendor/github.com/elastic/go-sysinfo/NOTICE.txt deleted file mode 100644 index ac43539..0000000 --- a/vendor/github.com/elastic/go-sysinfo/NOTICE.txt +++ /dev/null @@ -1,5 +0,0 @@ -Elastic go-sysinfo -Copyright 2017-2022 Elasticsearch B.V. - -This product includes software developed at -Elasticsearch, B.V. (https://www.elastic.co/). diff --git a/vendor/github.com/elastic/go-sysinfo/README.md b/vendor/github.com/elastic/go-sysinfo/README.md deleted file mode 100644 index 409432c..0000000 --- a/vendor/github.com/elastic/go-sysinfo/README.md +++ /dev/null @@ -1,81 +0,0 @@ -# go-sysinfo - -[![Build Status](https://beats-ci.elastic.co/job/Library/job/go-sysinfo-mbp/job/main/badge/icon)](https://beats-ci.elastic.co/job/Library/job/go-sysinfo-mbp/job/main/) -[![Go Documentation](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)][godocs] - -[godocs]: http://godoc.org/github.com/elastic/go-sysinfo - -go-sysinfo is a library for collecting system information. This includes -information about the host machine and processes running on the host. - -The available features vary based on what has been implemented by the "provider" -for the operating system. At runtime you check to see if additional interfaces -are implemented by the returned `Host` or `Process`. For example: - -```go -process, err := sysinfo.Self() -if err != nil { - return err -} - -if handleCounter, ok := process.(types.OpenHandleCounter); ok { - count, err := handleCounter.OpenHandleCount() - if err != nil { - return err - } - log.Printf("%d open handles", count) -} -``` - -These tables show what methods are implemented as well as the extra interfaces -that are implemented. - -| `Host` Features | Darwin | Linux | Windows | AIX | -|------------------|--------|-------|---------|-----| -| `Info()` | x | x | x | x | -| `Memory()` | x | x | x | x | -| `CPUTimer` | x | x | x | x | -| `LoadAverage` | x | x | | | -| `VMStat` | | x | | | -| `NetworkCounters`| | x | | | - -| `Process` Features | Darwin | Linux | Windows | AIX | -|------------------------|--------|-------|---------|-----| -| `Info()` | x | x | x | x | -| `Memory()` | x | x | x | x | -| `User()` | x | x | x | x | -| `Parent()` | x | x | x | x | -| `CPUTimer` | x | x | x | x | -| `Environment` | x | x | | x | -| `OpenHandleEnumerator` | | x | | | -| `OpenHandleCounter` | | x | | | -| `Seccomp` | | x | | | -| `Capabilities` | | x | | | -| `NetworkCounters` | | x | | | - -### GOOS / GOARCH Pairs - -This table lists the OS and architectures for which a "provider" is implemented. - -| GOOS / GOARCH | Requires CGO | Tested | -|----------------|--------------|--------| -| aix/ppc64 | x | | -| darwin/amd64 | optional * | x | -| darwin/arm64 | optional * | x | -| linux/386 | | | -| linux/amd64 | | x | -| linux/arm | | | -| linux/arm64 | | | -| linux/mips | | | -| linux/mips64 | | | -| linux/mips64le | | | -| linux/mipsle | | | -| linux/ppc64 | | | -| linux/ppc64le | | | -| linux/riscv64 | | | -| linux/s390x | | | -| windows/amd64 | | x | -| windows/arm64 | | | -| windows/arm | | | - -* On darwin (macOS) host information like machineid and process information like memory, cpu, user and starttime require cgo. diff --git a/vendor/github.com/elastic/go-sysinfo/internal/registry/registry.go b/vendor/github.com/elastic/go-sysinfo/internal/registry/registry.go deleted file mode 100644 index 071e2d6..0000000 --- a/vendor/github.com/elastic/go-sysinfo/internal/registry/registry.go +++ /dev/null @@ -1,58 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 registry - -import ( - "fmt" - - "github.com/elastic/go-sysinfo/types" -) - -var ( - hostProvider HostProvider - processProvider ProcessProvider -) - -type HostProvider interface { - Host() (types.Host, error) -} - -type ProcessProvider interface { - Processes() ([]types.Process, error) - Process(pid int) (types.Process, error) - Self() (types.Process, error) -} - -func Register(provider interface{}) { - if h, ok := provider.(HostProvider); ok { - if hostProvider != nil { - panic(fmt.Sprintf("HostProvider already registered: %v", hostProvider)) - } - hostProvider = h - } - - if p, ok := provider.(ProcessProvider); ok { - if processProvider != nil { - panic(fmt.Sprintf("ProcessProvider already registered: %v", processProvider)) - } - processProvider = p - } -} - -func GetHostProvider() HostProvider { return hostProvider } -func GetProcessProvider() ProcessProvider { return processProvider } diff --git a/vendor/github.com/elastic/go-sysinfo/providers/aix/boottime_aix_ppc64.go b/vendor/github.com/elastic/go-sysinfo/providers/aix/boottime_aix_ppc64.go deleted file mode 100644 index f1ecd41..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/aix/boottime_aix_ppc64.go +++ /dev/null @@ -1,79 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build aix && ppc64 -// +build aix,ppc64 - -package aix - -import ( - "encoding/binary" - "fmt" - "os" - "time" -) - -// utmp can't be used by "encoding/binary" if generated by cgo, -// some pads will be missing. -type utmp struct { - User [256]uint8 - Id [14]uint8 - Line [64]uint8 - XPad1 int16 - Pid int32 - Type int16 - XPad2 int16 - Time int64 - Termination int16 - Exit int16 - Host [256]uint8 - Xdblwordpad int32 - XreservedA [2]int32 - XreservedV [6]int32 -} - -const ( - typeBootTime = 2 -) - -// BootTime returns the time at which the machine was started, truncated to the nearest second -func BootTime() (time.Time, error) { - return bootTime("/etc/utmp") -} - -func bootTime(filename string) (time.Time, error) { - // Get boot time from /etc/utmp - file, err := os.Open(filename) - if err != nil { - return time.Time{}, fmt.Errorf("failed to get host uptime: cannot open /etc/utmp: %w", err) - } - - defer file.Close() - - for { - var utmp utmp - if err := binary.Read(file, binary.BigEndian, &utmp); err != nil { - break - } - - if utmp.Type == typeBootTime { - return time.Unix(utmp.Time, 0), nil - } - } - - return time.Time{}, fmt.Errorf("failed to get host uptime: no utmp record: %w", err) -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/aix/doc.go b/vendor/github.com/elastic/go-sysinfo/providers/aix/doc.go deleted file mode 100644 index aadec23..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/aix/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 aix implements the HostProvider and ProcessProvider interfaces -// for providing information about IBM AIX on ppc64. -package aix diff --git a/vendor/github.com/elastic/go-sysinfo/providers/aix/host_aix_ppc64.go b/vendor/github.com/elastic/go-sysinfo/providers/aix/host_aix_ppc64.go deleted file mode 100644 index 3cabe3f..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/aix/host_aix_ppc64.go +++ /dev/null @@ -1,215 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build aix && ppc64 && cgo -// +build aix,ppc64,cgo - -package aix - -/* -#cgo LDFLAGS: -L/usr/lib -lperfstat - -#include -#include -#include - -*/ -import "C" - -import ( - "errors" - "fmt" - "os" - "time" - - "github.com/joeshaw/multierror" - - "github.com/elastic/go-sysinfo/internal/registry" - "github.com/elastic/go-sysinfo/providers/shared" - "github.com/elastic/go-sysinfo/types" -) - -//go:generate sh -c "go tool cgo -godefs defs_aix.go | sed 's/*byte/uint64/g' > ztypes_aix_ppc64.go" -// As cgo will return some psinfo's fields with *byte, binary.Read will refuse this type. - -func init() { - registry.Register(aixSystem{}) -} - -type aixSystem struct{} - -// Host returns a new AIX host. -func (aixSystem) Host() (types.Host, error) { - return newHost() -} - -type host struct { - info types.HostInfo -} - -// Architecture returns the architecture of the host -func Architecture() (string, error) { - return "ppc", nil -} - -// Info returns the host details. -func (h *host) Info() types.HostInfo { - return h.info -} - -// Info returns the current CPU usage of the host. -func (*host) CPUTime() (types.CPUTimes, error) { - clock := uint64(C.sysconf(C._SC_CLK_TCK)) - tick2nsec := func(val uint64) uint64 { - return val * 1e9 / clock - } - - cpudata := C.perfstat_cpu_total_t{} - - if _, err := C.perfstat_cpu_total(nil, &cpudata, C.sizeof_perfstat_cpu_total_t, 1); err != nil { - return types.CPUTimes{}, fmt.Errorf("error while callin perfstat_cpu_total: %w", err) - } - - return types.CPUTimes{ - User: time.Duration(tick2nsec(uint64(cpudata.user))), - System: time.Duration(tick2nsec(uint64(cpudata.sys))), - Idle: time.Duration(tick2nsec(uint64(cpudata.idle))), - IOWait: time.Duration(tick2nsec(uint64(cpudata.wait))), - }, nil -} - -// Memory returns the current memory usage of the host. -func (*host) Memory() (*types.HostMemoryInfo, error) { - var mem types.HostMemoryInfo - - pagesize := uint64(os.Getpagesize()) - - meminfo := C.perfstat_memory_total_t{} - _, err := C.perfstat_memory_total(nil, &meminfo, C.sizeof_perfstat_memory_total_t, 1) - if err != nil { - return nil, fmt.Errorf("perfstat_memory_total failed: %w", err) - } - - mem.Total = uint64(meminfo.real_total) * pagesize - mem.Free = uint64(meminfo.real_free) * pagesize - mem.Used = uint64(meminfo.real_inuse) * pagesize - - // There is no real equivalent to memory available in AIX. - mem.Available = mem.Free - - mem.VirtualTotal = uint64(meminfo.virt_total) * pagesize - mem.VirtualFree = mem.Free + uint64(meminfo.pgsp_free)*pagesize - mem.VirtualUsed = mem.VirtualTotal - mem.VirtualFree - - return &mem, nil -} - -func newHost() (*host, error) { - h := &host{} - r := &reader{} - r.architecture(h) - r.bootTime(h) - r.hostname(h) - r.network(h) - r.kernelVersion(h) - r.os(h) - r.time(h) - r.uniqueID(h) - return h, r.Err() -} - -type reader struct { - errs []error -} - -func (r *reader) addErr(err error) bool { - if err != nil { - if !errors.Is(err, types.ErrNotImplemented) { - r.errs = append(r.errs, err) - } - return true - } - return false -} - -func (r *reader) Err() error { - if len(r.errs) > 0 { - return &multierror.MultiError{Errors: r.errs} - } - return nil -} - -func (r *reader) architecture(h *host) { - v, err := Architecture() - if r.addErr(err) { - return - } - h.info.Architecture = v -} - -func (r *reader) bootTime(h *host) { - v, err := BootTime() - if r.addErr(err) { - return - } - h.info.BootTime = v -} - -func (r *reader) hostname(h *host) { - v, err := os.Hostname() - if r.addErr(err) { - return - } - h.info.Hostname = v -} - -func (r *reader) network(h *host) { - ips, macs, err := shared.Network() - if r.addErr(err) { - return - } - h.info.IPs = ips - h.info.MACs = macs -} - -func (r *reader) kernelVersion(h *host) { - v, err := KernelVersion() - if r.addErr(err) { - return - } - h.info.KernelVersion = v -} - -func (r *reader) os(h *host) { - v, err := OperatingSystem() - if r.addErr(err) { - return - } - h.info.OS = v -} - -func (*reader) time(h *host) { - h.info.Timezone, h.info.TimezoneOffsetSec = time.Now().Zone() -} - -func (r *reader) uniqueID(h *host) { - v, err := MachineID() - if r.addErr(err) { - return - } - h.info.UniqueID = v -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/aix/kernel_aix_ppc64.go b/vendor/github.com/elastic/go-sysinfo/providers/aix/kernel_aix_ppc64.go deleted file mode 100644 index 9b03e2f..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/aix/kernel_aix_ppc64.go +++ /dev/null @@ -1,60 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build aix && ppc64 && cgo -// +build aix,ppc64,cgo - -package aix - -/* -#include -*/ -import "C" - -import ( - "fmt" - "strconv" -) - -var oslevel string - -func getKernelVersion() (int, int, error) { - name := C.struct_utsname{} - if _, err := C.uname(&name); err != nil { - return 0, 0, fmt.Errorf("kernel version: uname: %w", err) - } - - version, err := strconv.Atoi(C.GoString(&name.version[0])) - if err != nil { - return 0, 0, fmt.Errorf("parsing kernel version: %w", err) - } - - release, err := strconv.Atoi(C.GoString(&name.release[0])) - if err != nil { - return 0, 0, fmt.Errorf("parsing kernel release: %w", err) - } - return version, release, nil -} - -// KernelVersion returns the version of AIX kernel -func KernelVersion() (string, error) { - major, minor, err := getKernelVersion() - if err != nil { - return "", err - } - return strconv.Itoa(major) + "." + strconv.Itoa(minor), nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/aix/machineid_aix_ppc64.go b/vendor/github.com/elastic/go-sysinfo/providers/aix/machineid_aix_ppc64.go deleted file mode 100644 index 13458e5..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/aix/machineid_aix_ppc64.go +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build aix && ppc64 && cgo -// +build aix,ppc64,cgo - -package aix - -/* -#include -*/ -import "C" - -import "fmt" - -// MachineID returns the id of the machine -func MachineID() (string, error) { - name := C.struct_utsname{} - if _, err := C.uname(&name); err != nil { - return "", fmt.Errorf("machine id: %w", err) - } - return C.GoString(&name.machine[0]), nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/aix/os_aix_ppc64.go b/vendor/github.com/elastic/go-sysinfo/providers/aix/os_aix_ppc64.go deleted file mode 100644 index 03c87da..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/aix/os_aix_ppc64.go +++ /dev/null @@ -1,61 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build aix && ppc64 && cgo -// +build aix,ppc64,cgo - -package aix - -import ( - "fmt" - "io/ioutil" - "strconv" - "strings" - - "github.com/elastic/go-sysinfo/types" -) - -// OperatingSystem returns information of the host operating system -func OperatingSystem() (*types.OSInfo, error) { - return getOSInfo() -} - -func getOSInfo() (*types.OSInfo, error) { - major, minor, err := getKernelVersion() - if err != nil { - return nil, err - } - - // Retrieve build version from "/proc/version". - procVersion, err := ioutil.ReadFile("/proc/version") - if err != nil { - return nil, fmt.Errorf("failed to get OS info: cannot open /proc/version: %w", err) - } - build := strings.SplitN(string(procVersion), "\n", 4)[2] - - return &types.OSInfo{ - Type: "unix", - Family: "aix", - Platform: "aix", - Name: "aix", - Version: strconv.Itoa(major) + "." + strconv.Itoa(minor), - Major: major, - Minor: minor, - Patch: 0, // No patch version - Build: build, - }, nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/aix/process_aix_ppc64.go b/vendor/github.com/elastic/go-sysinfo/providers/aix/process_aix_ppc64.go deleted file mode 100644 index 440574e..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/aix/process_aix_ppc64.go +++ /dev/null @@ -1,302 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build aix && ppc64 && cgo -// +build aix,ppc64,cgo - -package aix - -/* -#cgo LDFLAGS: -L/usr/lib -lperfstat - -#include -#include -#include - -*/ -import "C" - -import ( - "bytes" - "encoding/binary" - "errors" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strconv" - "strings" - "syscall" - "time" - "unsafe" - - "github.com/elastic/go-sysinfo/types" -) - -// Processes returns a list of all actives processes. -func (aixSystem) Processes() ([]types.Process, error) { - // Retrieve processes using /proc instead of calling - // getprocs which will also retrieve kernel threads. - files, err := ioutil.ReadDir("/proc") - if err != nil { - return nil, fmt.Errorf("error while reading /proc: %w", err) - } - - processes := make([]types.Process, 0, len(files)) - for _, f := range files { - // Check that the file is a correct process directory. - // /proc also contains special files (/proc/version) and threads - // directories (/proc/pid directory but without any "as" file) - if _, err := os.Stat("/proc/" + f.Name() + "/as"); err == nil { - pid, _ := strconv.Atoi(f.Name()) - processes = append(processes, &process{pid: pid}) - } - } - - return processes, nil -} - -// Process returns the process designed by PID. -func (aixSystem) Process(pid int) (types.Process, error) { - p := process{pid: pid} - return &p, nil -} - -// Self returns the current process. -func (s aixSystem) Self() (types.Process, error) { - return s.Process(os.Getpid()) -} - -type process struct { - pid int - info *types.ProcessInfo - env map[string]string -} - -// PID returns the PID of a process. -func (p *process) PID() int { - return p.pid -} - -// Parent returns the parent of a process. -func (p *process) Parent() (types.Process, error) { - info, err := p.Info() - if err != nil { - return nil, err - } - return &process{pid: info.PPID}, nil -} - -// Info returns all information about the process. -func (p *process) Info() (types.ProcessInfo, error) { - if p.info != nil { - return *p.info, nil - } - - p.info = &types.ProcessInfo{ - PID: p.pid, - } - - // Retrieve PPID and StartTime - info := C.struct_procsinfo64{} - cpid := C.pid_t(p.pid) - - num, err := C.getprocs(unsafe.Pointer(&info), C.sizeof_struct_procsinfo64, nil, 0, &cpid, 1) - if num != 1 { - err = syscall.ESRCH - } - if err != nil { - return types.ProcessInfo{}, fmt.Errorf("error while calling getprocs: %w", err) - } - - p.info.PPID = int(info.pi_ppid) - // pi_start is the time in second since the process have started. - p.info.StartTime = time.Unix(0, int64(uint64(info.pi_start)*1000*uint64(time.Millisecond))) - - // Retrieve arguments and executable name - // If buffer is not large enough, args are truncated - buf := make([]byte, 8192) - var args []string - if _, err := C.getargs(unsafe.Pointer(&info), C.sizeof_struct_procsinfo64, (*C.char)(&buf[0]), 8192); err != nil { - return types.ProcessInfo{}, fmt.Errorf("error while calling getargs: %w", err) - } - - bbuf := bytes.NewBuffer(buf) - for { - arg, err := bbuf.ReadBytes(0) - if err == io.EOF || arg[0] == 0 { - break - } - if err != nil { - return types.ProcessInfo{}, fmt.Errorf("error while reading arguments: %w", err) - } - - args = append(args, string(chop(arg))) - } - - // For some special programs, getargs might return an empty buffer. - if len(args) == 0 { - args = append(args, "") - } - - // The first element of the arguments list is the executable path. - // There are some exceptions which don't have an executable path - // but rather a special name directly in args[0]. - if strings.Contains(args[0], "sshd: ") { - // ssh connections can be named "sshd: root@pts/11". - // If we are using filepath.Base, the result will only - // be 11 because of the last "/". - p.info.Name = args[0] - } else { - p.info.Name = filepath.Base(args[0]) - } - - // The process was launched using its absolute path, so we can retrieve - // the executable path from its "name". - if filepath.IsAbs(args[0]) { - p.info.Exe = filepath.Clean(args[0]) - } else { - // TODO: improve this case. The executable full path can still - // be retrieve in some cases. Look at os/executable_path.go - // in the stdlib. - // For the moment, let's "exe" be the same as "name" - p.info.Exe = p.info.Name - } - p.info.Args = args - - // Get CWD - cwd, err := os.Readlink("/proc/" + strconv.Itoa(p.pid) + "/cwd") - if err != nil { - if !os.IsNotExist(err) { - return types.ProcessInfo{}, fmt.Errorf("error while reading /proc/%s/cwd: %w", strconv.Itoa(p.pid), err) - } - } - - p.info.CWD = strings.TrimSuffix(cwd, "/") - - return *p.info, nil -} - -// Environment returns the environment of a process. -func (p *process) Environment() (map[string]string, error) { - if p.env != nil { - return p.env, nil - } - p.env = map[string]string{} - - /* If buffer is not large enough, args are truncated */ - buf := make([]byte, 8192) - info := C.struct_procsinfo64{} - info.pi_pid = C.pid_t(p.pid) - - if _, err := C.getevars(unsafe.Pointer(&info), C.sizeof_struct_procsinfo64, (*C.char)(&buf[0]), 8192); err != nil { - return nil, fmt.Errorf("error while calling getevars: %w", err) - } - - bbuf := bytes.NewBuffer(buf) - - delim := []byte{61} // "=" - - for { - line, err := bbuf.ReadBytes(0) - if err == io.EOF || line[0] == 0 { - break - } - if err != nil { - return nil, fmt.Errorf("error while calling getevars: %w", err) - } - - pair := bytes.SplitN(chop(line), delim, 2) - if len(pair) != 2 { - return nil, errors.New("error reading process environment") - } - p.env[string(pair[0])] = string(pair[1]) - } - - return p.env, nil -} - -// User returns the user IDs of a process. -func (p *process) User() (types.UserInfo, error) { - var prcred prcred - if err := p.decodeProcfsFile("cred", &prcred); err != nil { - return types.UserInfo{}, err - } - return types.UserInfo{ - UID: strconv.Itoa(int(prcred.Ruid)), - EUID: strconv.Itoa(int(prcred.Euid)), - SUID: strconv.Itoa(int(prcred.Suid)), - GID: strconv.Itoa(int(prcred.Rgid)), - EGID: strconv.Itoa(int(prcred.Egid)), - SGID: strconv.Itoa(int(prcred.Sgid)), - }, nil -} - -// Memory returns the current memory usage of a process. -func (p *process) Memory() (types.MemoryInfo, error) { - var mem types.MemoryInfo - pagesize := uint64(os.Getpagesize()) - - info := C.struct_procsinfo64{} - cpid := C.pid_t(p.pid) - - num, err := C.getprocs(unsafe.Pointer(&info), C.sizeof_struct_procsinfo64, nil, 0, &cpid, 1) - if num != 1 { - err = syscall.ESRCH - } - if err != nil { - return types.MemoryInfo{}, fmt.Errorf("error while calling getprocs: %w", err) - } - - mem.Resident = uint64(info.pi_drss+info.pi_trss) * pagesize - mem.Virtual = uint64(info.pi_dvm) * pagesize - - return mem, nil -} - -// CPUTime returns the current CPU usage of a process. -func (p *process) CPUTime() (types.CPUTimes, error) { - var pstatus pstatus - if err := p.decodeProcfsFile("status", &pstatus); err != nil { - return types.CPUTimes{}, err - } - return types.CPUTimes{ - User: time.Duration(pstatus.Utime.Sec*1e9 + int64(pstatus.Utime.Nsec)), - System: time.Duration(pstatus.Stime.Sec*1e9 + int64(pstatus.Stime.Nsec)), - }, nil -} - -func (p *process) decodeProcfsFile(name string, data interface{}) error { - fileName := "/proc/" + strconv.Itoa(p.pid) + "/" + name - - file, err := os.Open(fileName) - if err != nil { - return fmt.Errorf("error while opening %s: %w", fileName, err) - } - defer file.Close() - - if err := binary.Read(file, binary.BigEndian, data); err != nil { - return fmt.Errorf("error while decoding %s: %w", fileName, err) - } - - return nil -} - -func chop(buf []byte) []byte { - return buf[0 : len(buf)-1] -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/aix/ztypes_aix_ppc64.go b/vendor/github.com/elastic/go-sysinfo/providers/aix/ztypes_aix_ppc64.go deleted file mode 100644 index fb60e7d..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/aix/ztypes_aix_ppc64.go +++ /dev/null @@ -1,159 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs defs_aix.go - -//go:build aix && ppc64 -// +build aix,ppc64 - -package aix - -type prcred struct { - Euid uint64 - Ruid uint64 - Suid uint64 - Egid uint64 - Rgid uint64 - Sgid uint64 - X_pad [8]uint64 - X_pad1 uint32 - Ngroups uint32 - Groups [1]uint64 -} - -type pstatus struct { - Flag uint32 - Flag2 uint32 - Flags uint32 - Nlwp uint32 - Stat uint8 - Dmodel uint8 - X_pad1 [6]uint8 - Sigpend prSigset - Brkbase uint64 - Brksize uint64 - Stkbase uint64 - Stksize uint64 - Pid uint64 - Ppid uint64 - Pgid uint64 - Sid uint64 - Utime prTimestruc64 - Stime prTimestruc64 - Cutime prTimestruc64 - Cstime prTimestruc64 - Sigtrace prSigset - Flttrace fltset - Sysentry_offset uint32 - Sysexit_offset uint32 - X_pad [8]uint64 - Lwp lwpstatus -} - -type prTimestruc64 struct { - Sec int64 - Nsec int32 - X__pad uint32 -} - -type prSigset struct { - Set [4]uint64 -} - -type fltset struct { - Set [4]uint64 -} - -type lwpstatus struct { - Lwpid uint64 - Flags uint32 - X_pad1 [1]uint8 - State uint8 - Cursig uint16 - Why uint16 - What uint16 - Policy uint32 - Clname [8]uint8 - Lwppend prSigset - Lwphold prSigset - Info prSiginfo64 - Altstack prStack64 - Action prSigaction64 - X_pad2 uint32 - Syscall uint16 - Nsysarg uint16 - Sysarg [8]uint64 - Errno int32 - Ptid uint32 - X_pad [9]uint64 - Reg prgregset - Fpreg prfpregset - Family pfamily -} - -type prSiginfo64 struct { - Signo int32 - Errno int32 - Code int32 - Imm int32 - Status int32 - X__pad1 uint32 - Uid uint64 - Pid uint64 - Addr uint64 - Band int64 - Value [8]byte - X__pad [4]uint32 -} - -type prStack64 struct { - Sp uint64 - Size uint64 - Flags int32 - X__pad [5]int32 -} - -type prSigaction64 struct { - Union [8]byte - Mask prSigset - Flags int32 - X__pad [5]int32 -} - -type prgregset struct { - X__iar uint64 - X__msr uint64 - X__cr uint64 - X__lr uint64 - X__ctr uint64 - X__xer uint64 - X__fpscr uint64 - X__fpscrx uint64 - X__gpr [32]uint64 - X__pad1 [8]uint64 -} - -type prfpregset struct { - X__fpr [32]float64 -} - -type pfamily struct { - Extoff uint64 - Extsize uint64 - Pad [14]uint64 -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/darwin/arch_darwin.go b/vendor/github.com/elastic/go-sysinfo/providers/darwin/arch_darwin.go deleted file mode 100644 index 591486f..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/darwin/arch_darwin.go +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build amd64 || arm64 -// +build amd64 arm64 - -package darwin - -import ( - "fmt" - - "golang.org/x/sys/unix" -) - -const hardwareMIB = "hw.machine" - -func Architecture() (string, error) { - arch, err := unix.Sysctl(hardwareMIB) - if err != nil { - return "", fmt.Errorf("failed to get architecture: %w", err) - } - - return arch, nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/darwin/boottime_darwin.go b/vendor/github.com/elastic/go-sysinfo/providers/darwin/boottime_darwin.go deleted file mode 100644 index 989c708..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/darwin/boottime_darwin.go +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build amd64 || arm64 -// +build amd64 arm64 - -package darwin - -import ( - "fmt" - "time" - - "golang.org/x/sys/unix" -) - -const kernBoottimeMIB = "kern.boottime" - -func BootTime() (time.Time, error) { - tv, err := unix.SysctlTimeval(kernBoottimeMIB) - if err != nil { - return time.Time{}, fmt.Errorf("failed to get host uptime: %w", err) - } - - bootTime := time.Unix(int64(tv.Sec), int64(tv.Usec)*int64(time.Microsecond)) - return bootTime, nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/darwin/doc.go b/vendor/github.com/elastic/go-sysinfo/providers/darwin/doc.go deleted file mode 100644 index 20e80f0..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/darwin/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 darwin implements the HostProvider and ProcessProvider interfaces -// for providing information about MacOS. -package darwin diff --git a/vendor/github.com/elastic/go-sysinfo/providers/darwin/host_darwin.go b/vendor/github.com/elastic/go-sysinfo/providers/darwin/host_darwin.go deleted file mode 100644 index 7d23d01..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/darwin/host_darwin.go +++ /dev/null @@ -1,251 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build amd64 || arm64 -// +build amd64 arm64 - -package darwin - -import ( - "errors" - "fmt" - "os" - "time" - - "github.com/joeshaw/multierror" - - "github.com/elastic/go-sysinfo/internal/registry" - "github.com/elastic/go-sysinfo/providers/shared" - "github.com/elastic/go-sysinfo/types" -) - -func init() { - registry.Register(darwinSystem{}) -} - -type darwinSystem struct{} - -func (s darwinSystem) Host() (types.Host, error) { - return newHost() -} - -type host struct { - info types.HostInfo -} - -func (h *host) Info() types.HostInfo { - return h.info -} - -func (h *host) CPUTime() (types.CPUTimes, error) { - cpu, err := getHostCPULoadInfo() - if err != nil { - return types.CPUTimes{}, fmt.Errorf("failed to get host CPU usage: %w", err) - } - - ticksPerSecond := time.Duration(getClockTicks()) - - return types.CPUTimes{ - User: time.Duration(cpu.User) * time.Second / ticksPerSecond, - System: time.Duration(cpu.System) * time.Second / ticksPerSecond, - Idle: time.Duration(cpu.Idle) * time.Second / ticksPerSecond, - Nice: time.Duration(cpu.Nice) * time.Second / ticksPerSecond, - }, nil -} - -func (h *host) Memory() (*types.HostMemoryInfo, error) { - var mem types.HostMemoryInfo - - // Total physical memory. - total, err := MemTotal() - if err != nil { - return nil, fmt.Errorf("failed to get total physical memory: %w", err) - } - - mem.Total = total - - // Page size for computing byte totals. - pageSizeBytes, err := getPageSize() - if err != nil { - return nil, fmt.Errorf("failed to get page size: %w", err) - } - - // Swap - swap, err := getSwapUsage() - if err != nil { - return nil, fmt.Errorf("failed to get swap usage: %w", err) - } - - mem.VirtualTotal = swap.Total - mem.VirtualUsed = swap.Used - mem.VirtualFree = swap.Available - - // Virtual Memory Statistics - vmStat, err := getHostVMInfo64() - if errors.Is(err, types.ErrNotImplemented) { - return &mem, nil - } - - if err != nil { - return nil, fmt.Errorf("failed to get virtual memory statistics: %w", err) - } - - inactiveBytes := uint64(vmStat.Inactive_count) * pageSizeBytes - purgeableBytes := uint64(vmStat.Purgeable_count) * pageSizeBytes - mem.Metrics = map[string]uint64{ - "active_bytes": uint64(vmStat.Active_count) * pageSizeBytes, - "compressed_bytes": uint64(vmStat.Compressor_page_count) * pageSizeBytes, - "compressions_bytes": uint64(vmStat.Compressions) * pageSizeBytes, // Cumulative compressions. - "copy_on_write_faults": vmStat.Cow_faults, - "decompressions_bytes": uint64(vmStat.Decompressions) * pageSizeBytes, // Cumulative decompressions. - "external_bytes": uint64(vmStat.External_page_count) * pageSizeBytes, // File Cache / File-backed pages - "inactive_bytes": inactiveBytes, - "internal_bytes": uint64(vmStat.Internal_page_count) * pageSizeBytes, // App Memory / Anonymous - "page_ins_bytes": uint64(vmStat.Pageins) * pageSizeBytes, - "page_outs_bytes": uint64(vmStat.Pageouts) * pageSizeBytes, - "purgeable_bytes": purgeableBytes, - "purged_bytes": uint64(vmStat.Purges) * pageSizeBytes, - "reactivated_bytes": uint64(vmStat.Reactivations) * pageSizeBytes, - "speculative_bytes": uint64(vmStat.Speculative_count) * pageSizeBytes, - "swap_ins_bytes": uint64(vmStat.Swapins) * pageSizeBytes, - "swap_outs_bytes": uint64(vmStat.Swapouts) * pageSizeBytes, - "throttled_bytes": uint64(vmStat.Throttled_count) * pageSizeBytes, - "translation_faults": vmStat.Faults, - "uncompressed_bytes": uint64(vmStat.Total_uncompressed_pages_in_compressor) * pageSizeBytes, - "wired_bytes": uint64(vmStat.Wire_count) * pageSizeBytes, - "zero_filled_bytes": uint64(vmStat.Zero_fill_count) * pageSizeBytes, - } - - // From Activity Monitor: Memory Used = App Memory (internal) + Wired + Compressed - // https://support.apple.com/en-us/HT201538 - mem.Used = uint64(vmStat.Internal_page_count+vmStat.Wire_count+vmStat.Compressor_page_count) * pageSizeBytes - mem.Free = uint64(vmStat.Free_count) * pageSizeBytes - mem.Available = mem.Free + inactiveBytes + purgeableBytes - - return &mem, nil -} - -func (h *host) LoadAverage() (*types.LoadAverageInfo, error) { - load, err := getLoadAverage() - if err != nil { - return nil, fmt.Errorf("failed to get loadavg: %w", err) - } - - scale := float64(load.scale) - - return &types.LoadAverageInfo{ - One: float64(load.load[0]) / scale, - Five: float64(load.load[1]) / scale, - Fifteen: float64(load.load[2]) / scale, - }, nil -} - -func newHost() (*host, error) { - h := &host{} - r := &reader{} - r.architecture(h) - r.bootTime(h) - r.hostname(h) - r.network(h) - r.kernelVersion(h) - r.os(h) - r.time(h) - r.uniqueID(h) - return h, r.Err() -} - -type reader struct { - errs []error -} - -func (r *reader) addErr(err error) bool { - if err != nil { - if !errors.Is(err, types.ErrNotImplemented) { - r.errs = append(r.errs, err) - } - return true - } - return false -} - -func (r *reader) Err() error { - if len(r.errs) > 0 { - return &multierror.MultiError{Errors: r.errs} - } - return nil -} - -func (r *reader) architecture(h *host) { - v, err := Architecture() - if r.addErr(err) { - return - } - h.info.Architecture = v -} - -func (r *reader) bootTime(h *host) { - v, err := BootTime() - if r.addErr(err) { - return - } - h.info.BootTime = v -} - -func (r *reader) hostname(h *host) { - v, err := os.Hostname() - if r.addErr(err) { - return - } - h.info.Hostname = v -} - -func (r *reader) network(h *host) { - ips, macs, err := shared.Network() - if r.addErr(err) { - return - } - h.info.IPs = ips - h.info.MACs = macs -} - -func (r *reader) kernelVersion(h *host) { - v, err := KernelVersion() - if r.addErr(err) { - return - } - h.info.KernelVersion = v -} - -func (r *reader) os(h *host) { - v, err := OperatingSystem() - if r.addErr(err) { - return - } - h.info.OS = v -} - -func (r *reader) time(h *host) { - h.info.Timezone, h.info.TimezoneOffsetSec = time.Now().Zone() -} - -func (r *reader) uniqueID(h *host) { - v, err := MachineID() - if r.addErr(err) { - return - } - h.info.UniqueID = v -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/darwin/kernel_darwin.go b/vendor/github.com/elastic/go-sysinfo/providers/darwin/kernel_darwin.go deleted file mode 100644 index cc2a1c6..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/darwin/kernel_darwin.go +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build !386 -// +build !386 - -package darwin - -import ( - "fmt" - "syscall" -) - -const kernelReleaseMIB = "kern.osrelease" - -func KernelVersion() (string, error) { - version, err := syscall.Sysctl(kernelReleaseMIB) - if err != nil { - return "", fmt.Errorf("failed to get kernel version: %w", err) - } - - return version, nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/darwin/load_average_darwin.go b/vendor/github.com/elastic/go-sysinfo/providers/darwin/load_average_darwin.go deleted file mode 100644 index 3232208..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/darwin/load_average_darwin.go +++ /dev/null @@ -1,45 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build amd64 || arm64 -// +build amd64 arm64 - -package darwin - -import ( - "unsafe" - - "golang.org/x/sys/unix" -) - -const loadAverage = "vm.loadavg" - -type loadAvg struct { - load [3]uint32 - scale int -} - -func getLoadAverage() (*loadAvg, error) { - data, err := unix.SysctlRaw(loadAverage) - if err != nil { - return nil, err - } - - load := *(*loadAvg)(unsafe.Pointer((&data[0]))) - - return &load, nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/darwin/machineid_darwin.go b/vendor/github.com/elastic/go-sysinfo/providers/darwin/machineid_darwin.go deleted file mode 100644 index 178a854..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/darwin/machineid_darwin.go +++ /dev/null @@ -1,61 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build (amd64 && cgo) || (arm64 && cgo) -// +build amd64,cgo arm64,cgo - -package darwin - -// #include -// #include -import "C" - -import ( - "fmt" - "unsafe" -) - -// MachineID returns the Hardware UUID also accessible via -// About this Mac -> System Report and as the field -// IOPlatformUUID in the output of "ioreg -d2 -c IOPlatformExpertDevice". -func MachineID() (string, error) { - return getHostUUID() -} - -func getHostUUID() (string, error) { - var uuidC C.uuid_t - var id [unsafe.Sizeof(uuidC)]C.uchar - wait := C.struct_timespec{5, 0} // 5 seconds - - ret, err := C.gethostuuid(&id[0], &wait) - if ret != 0 { - if err != nil { - return "", fmt.Errorf("gethostuuid failed with %v: %w", ret, err) - } - - return "", fmt.Errorf("gethostuuid failed with %v", ret) - } - - var uuidStringC C.uuid_string_t - var uuid [unsafe.Sizeof(uuidStringC)]C.char - _, err = C.uuid_unparse_upper(&id[0], &uuid[0]) - if err != nil { - return "", fmt.Errorf("uuid_unparse_upper failed: %w", err) - } - - return C.GoString(&uuid[0]), nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/darwin/machineid_nocgo_darwin.go b/vendor/github.com/elastic/go-sysinfo/providers/darwin/machineid_nocgo_darwin.go deleted file mode 100644 index a692fde..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/darwin/machineid_nocgo_darwin.go +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build (amd64 && !cgo) || (arm64 && !cgo) - -package darwin - -import ( - "fmt" - - "github.com/elastic/go-sysinfo/types" -) - -func MachineID() (string, error) { - return "", fmt.Errorf("machineid requires cgo: %w", types.ErrNotImplemented) -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/darwin/memory_darwin.go b/vendor/github.com/elastic/go-sysinfo/providers/darwin/memory_darwin.go deleted file mode 100644 index 02e39dd..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/darwin/memory_darwin.go +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build amd64 || arm64 -// +build amd64 arm64 - -package darwin - -import ( - "fmt" - - "golang.org/x/sys/unix" -) - -const hwMemsizeMIB = "hw.memsize" - -func MemTotal() (uint64, error) { - size, err := unix.SysctlUint64(hwMemsizeMIB) - if err != nil { - return 0, fmt.Errorf("failed to get mem total: %w", err) - } - - return size, nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/darwin/os.go b/vendor/github.com/elastic/go-sysinfo/providers/darwin/os.go deleted file mode 100644 index 0dbe847..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/darwin/os.go +++ /dev/null @@ -1,94 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 darwin - -import ( - "fmt" - "io/ioutil" - "strconv" - "strings" - - "howett.net/plist" - - "github.com/elastic/go-sysinfo/types" -) - -const ( - systemVersionPlist = "/System/Library/CoreServices/SystemVersion.plist" - - plistProductName = "ProductName" - plistProductVersion = "ProductVersion" - plistProductBuildVersion = "ProductBuildVersion" -) - -func OperatingSystem() (*types.OSInfo, error) { - data, err := ioutil.ReadFile(systemVersionPlist) - if err != nil { - return nil, fmt.Errorf("failed to read plist file: %w", err) - } - - return getOSInfo(data) -} - -func getOSInfo(data []byte) (*types.OSInfo, error) { - attrs := map[string]string{} - if _, err := plist.Unmarshal(data, &attrs); err != nil { - return nil, fmt.Errorf("failed to unmarshal plist data: %w", err) - } - - productName, found := attrs[plistProductName] - if !found { - return nil, fmt.Errorf("plist key %v not found", plistProductName) - } - - version, found := attrs[plistProductVersion] - if !found { - return nil, fmt.Errorf("plist key %v not found", plistProductVersion) - } - - build, found := attrs[plistProductBuildVersion] - if !found { - return nil, fmt.Errorf("plist key %v not found", plistProductBuildVersion) - } - - var major, minor, patch int - for i, v := range strings.SplitN(version, ".", 3) { - switch i { - case 0: - major, _ = strconv.Atoi(v) - case 1: - minor, _ = strconv.Atoi(v) - case 2: - patch, _ = strconv.Atoi(v) - default: - break - } - } - - return &types.OSInfo{ - Type: "macos", - Family: "darwin", - Platform: "darwin", - Name: productName, - Version: version, - Major: major, - Minor: minor, - Patch: patch, - Build: build, - }, nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/darwin/process_cgo_darwin.go b/vendor/github.com/elastic/go-sysinfo/providers/darwin/process_cgo_darwin.go deleted file mode 100644 index 4d82812..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/darwin/process_cgo_darwin.go +++ /dev/null @@ -1,59 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build (amd64 && cgo) || (arm64 && cgo) -// +build amd64,cgo arm64,cgo - -package darwin - -// #cgo LDFLAGS:-lproc -// #include -// #include -import "C" - -import ( - "errors" - "unsafe" -) - -//go:generate sh -c "go tool cgo -godefs defs_darwin.go > ztypes_darwin.go" - -func getProcTaskAllInfo(pid int, info *procTaskAllInfo) error { - size := C.int(unsafe.Sizeof(*info)) - ptr := unsafe.Pointer(info) - - n, err := C.proc_pidinfo(C.int(pid), C.PROC_PIDTASKALLINFO, 0, ptr, size) - if err != nil { - return err - } else if n != size { - return errors.New("failed to read process info with proc_pidinfo") - } - - return nil -} - -func getProcVnodePathInfo(pid int, info *procVnodePathInfo) error { - size := C.int(unsafe.Sizeof(*info)) - ptr := unsafe.Pointer(info) - - n := C.proc_pidinfo(C.int(pid), C.PROC_PIDVNODEPATHINFO, 0, ptr, size) - if n != size { - return errors.New("failed to read vnode info with proc_pidinfo") - } - - return nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/darwin/process_darwin.go b/vendor/github.com/elastic/go-sysinfo/providers/darwin/process_darwin.go deleted file mode 100644 index b63367e..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/darwin/process_darwin.go +++ /dev/null @@ -1,242 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build amd64 || arm64 -// +build amd64 arm64 - -package darwin - -import ( - "bytes" - "encoding/binary" - "fmt" - "os" - "strconv" - "time" - - "golang.org/x/sys/unix" - - "github.com/elastic/go-sysinfo/types" -) - -func (s darwinSystem) Processes() ([]types.Process, error) { - ps, err := unix.SysctlKinfoProcSlice("kern.proc.all") - if err != nil { - return nil, fmt.Errorf("failed to read process table: %w", err) - } - - processes := make([]types.Process, 0, len(ps)) - for _, kp := range ps { - pid := kp.Proc.P_pid - if pid == 0 { - continue - } - - processes = append(processes, &process{ - pid: int(pid), - }) - } - - return processes, nil -} - -func (s darwinSystem) Process(pid int) (types.Process, error) { - p := process{pid: pid} - - return &p, nil -} - -func (s darwinSystem) Self() (types.Process, error) { - return s.Process(os.Getpid()) -} - -type process struct { - info *types.ProcessInfo - pid int - cwd string - exe string - args []string - env map[string]string -} - -func (p *process) PID() int { - return p.pid -} - -func (p *process) Parent() (types.Process, error) { - info, err := p.Info() - if err != nil { - return nil, err - } - - return &process{pid: info.PPID}, nil -} - -func (p *process) Info() (types.ProcessInfo, error) { - if p.info != nil { - return *p.info, nil - } - - var task procTaskAllInfo - if err := getProcTaskAllInfo(p.pid, &task); err != nil && err != types.ErrNotImplemented { - return types.ProcessInfo{}, err - } - - var vnode procVnodePathInfo - if err := getProcVnodePathInfo(p.pid, &vnode); err != nil && err != types.ErrNotImplemented { - return types.ProcessInfo{}, err - } - - if err := kern_procargs(p.pid, p); err != nil { - return types.ProcessInfo{}, err - } - - p.info = &types.ProcessInfo{ - Name: int8SliceToString(task.Pbsd.Pbi_name[:]), - PID: p.pid, - PPID: int(task.Pbsd.Pbi_ppid), - CWD: int8SliceToString(vnode.Cdir.Path[:]), - Exe: p.exe, - Args: p.args, - StartTime: time.Unix(int64(task.Pbsd.Pbi_start_tvsec), - int64(task.Pbsd.Pbi_start_tvusec)*int64(time.Microsecond)), - } - - return *p.info, nil -} - -func (p *process) User() (types.UserInfo, error) { - kproc, err := unix.SysctlKinfoProc("kern.proc.pid", p.pid) - if err != nil { - return types.UserInfo{}, err - } - - egid := "" - if len(kproc.Eproc.Ucred.Groups) > 0 { - egid = strconv.Itoa(int(kproc.Eproc.Ucred.Groups[0])) - } - - return types.UserInfo{ - UID: strconv.Itoa(int(kproc.Eproc.Pcred.P_ruid)), - EUID: strconv.Itoa(int(kproc.Eproc.Ucred.Uid)), - SUID: strconv.Itoa(int(kproc.Eproc.Pcred.P_svuid)), - GID: strconv.Itoa(int(kproc.Eproc.Pcred.P_rgid)), - SGID: strconv.Itoa(int(kproc.Eproc.Pcred.P_svgid)), - EGID: egid, - }, nil -} - -func (p *process) Environment() (map[string]string, error) { - return p.env, nil -} - -func (p *process) CPUTime() (types.CPUTimes, error) { - var task procTaskAllInfo - if err := getProcTaskAllInfo(p.pid, &task); err != nil { - return types.CPUTimes{}, err - } - return types.CPUTimes{ - User: time.Duration(task.Ptinfo.Total_user), - System: time.Duration(task.Ptinfo.Total_system), - }, nil -} - -func (p *process) Memory() (types.MemoryInfo, error) { - var task procTaskAllInfo - if err := getProcTaskAllInfo(p.pid, &task); err != nil { - return types.MemoryInfo{}, err - } - return types.MemoryInfo{ - Virtual: task.Ptinfo.Virtual_size, - Resident: task.Ptinfo.Resident_size, - Metrics: map[string]uint64{ - "page_ins": uint64(task.Ptinfo.Pageins), - "page_faults": uint64(task.Ptinfo.Faults), - }, - }, nil -} - -var nullTerminator = []byte{0} - -// wrapper around sysctl KERN_PROCARGS2 -// callbacks params are optional, -// up to the caller as to which pieces of data they want -func kern_procargs(pid int, p *process) error { - data, err := unix.SysctlRaw("kern.procargs2", pid) - if err != nil { - return nil - } - buf := bytes.NewBuffer(data) - - // argc - var argc int32 - if err := binary.Read(buf, binary.LittleEndian, &argc); err != nil { - return err - } - - // exe - lines := bytes.Split(buf.Bytes(), nullTerminator) - p.exe = string(lines[0]) - lines = lines[1:] - - // skip nulls - for len(lines) > 0 { - if len(lines[0]) == 0 { - lines = lines[1:] - continue - } - break - } - - // args - for i := 0; i < int(argc); i++ { - p.args = append(p.args, string(lines[0])) - lines = lines[1:] - } - - // env vars - env := make(map[string]string, len(lines)) - for _, l := range lines { - if len(l) == 0 { - break - } - - parts := bytes.SplitN(l, []byte{'='}, 2) - key := string(parts[0]) - var value string - if len(parts) == 2 { - value = string(parts[1]) - } - env[key] = value - } - p.env = env - - return nil -} - -func int8SliceToString(s []int8) string { - buf := bytes.NewBuffer(make([]byte, len(s))) - buf.Reset() - - for _, b := range s { - if b == 0 { - break - } - buf.WriteByte(byte(b)) - } - return buf.String() -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/darwin/process_nocgo_darwin.go b/vendor/github.com/elastic/go-sysinfo/providers/darwin/process_nocgo_darwin.go deleted file mode 100644 index 0ca7a86..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/darwin/process_nocgo_darwin.go +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build (amd64 && !cgo) || (arm64 && !cgo) - -package darwin - -import "github.com/elastic/go-sysinfo/types" - -func getProcTaskAllInfo(pid int, info *procTaskAllInfo) error { - return types.ErrNotImplemented -} - -func getProcVnodePathInfo(pid int, info *procVnodePathInfo) error { - return types.ErrNotImplemented -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/darwin/syscall_cgo_darwin.go b/vendor/github.com/elastic/go-sysinfo/providers/darwin/syscall_cgo_darwin.go deleted file mode 100644 index b79072e..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/darwin/syscall_cgo_darwin.go +++ /dev/null @@ -1,72 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build (amd64 && cgo) || (arm64 && cgo) -// +build amd64,cgo arm64,cgo - -package darwin - -/* -#cgo LDFLAGS:-lproc -#include -#include -#include -#include -*/ -import "C" - -import ( - "fmt" - "unsafe" -) - -func getHostCPULoadInfo() (*cpuUsage, error) { - var count C.mach_msg_type_number_t = C.HOST_CPU_LOAD_INFO_COUNT - var cpu cpuUsage - status := C.host_statistics(C.host_t(C.mach_host_self()), - C.HOST_CPU_LOAD_INFO, - C.host_info_t(unsafe.Pointer(&cpu)), - &count) - - if status != C.KERN_SUCCESS { - return nil, fmt.Errorf("host_statistics returned status %d", status) - } - - return &cpu, nil -} - -// getClockTicks returns the number of click ticks in one jiffie. -func getClockTicks() int { - return int(C.sysconf(C._SC_CLK_TCK)) -} - -func getHostVMInfo64() (*vmStatistics64Data, error) { - var count C.mach_msg_type_number_t = C.HOST_VM_INFO64_COUNT - - var vmStat vmStatistics64Data - status := C.host_statistics64( - C.host_t(C.mach_host_self()), - C.HOST_VM_INFO64, - C.host_info_t(unsafe.Pointer(&vmStat)), - &count) - - if status != C.KERN_SUCCESS { - return nil, fmt.Errorf("host_statistics64 returned status %d", status) - } - - return &vmStat, nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/darwin/syscall_darwin.go b/vendor/github.com/elastic/go-sysinfo/providers/darwin/syscall_darwin.go deleted file mode 100644 index 91d883f..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/darwin/syscall_darwin.go +++ /dev/null @@ -1,69 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build amd64 || arm64 -// +build amd64 arm64 - -package darwin - -import ( - "bytes" - "encoding/binary" - "fmt" - - "golang.org/x/sys/unix" -) - -type cpuUsage struct { - User uint32 - System uint32 - Idle uint32 - Nice uint32 -} - -func getPageSize() (uint64, error) { - i, err := unix.SysctlUint32("vm.pagesize") - if err != nil { - return 0, fmt.Errorf("vm.pagesize returned %w", err) - } - - return uint64(i), nil -} - -// From sysctl.h - xsw_usage. -type swapUsage struct { - Total uint64 - Available uint64 - Used uint64 - PageSize uint64 -} - -const vmSwapUsageMIB = "vm.swapusage" - -func getSwapUsage() (*swapUsage, error) { - var swap swapUsage - data, err := unix.SysctlRaw(vmSwapUsageMIB) - if err != nil { - return nil, err - } - - if err := binary.Read(bytes.NewReader(data), binary.LittleEndian, &swap); err != nil { - return nil, err - } - - return &swap, nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/darwin/syscall_nocgo_darwin.go b/vendor/github.com/elastic/go-sysinfo/providers/darwin/syscall_nocgo_darwin.go deleted file mode 100644 index 6a74d8d..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/darwin/syscall_nocgo_darwin.go +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -//go:build (amd64 && !cgo) || (arm64 && !cgo) - -package darwin - -import ( - "fmt" - - "github.com/elastic/go-sysinfo/types" -) - -func getHostCPULoadInfo() (*cpuUsage, error) { - return nil, fmt.Errorf("host cpu load requires cgo: %w", types.ErrNotImplemented) -} - -// getClockTicks returns the number of click ticks in one jiffie. -func getClockTicks() int { - return 0 -} - -func getHostVMInfo64() (*vmStatistics64Data, error) { - return nil, fmt.Errorf("host vm info requires cgo: %w", types.ErrNotImplemented) -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/darwin/ztypes_darwin.go b/vendor/github.com/elastic/go-sysinfo/providers/darwin/ztypes_darwin.go deleted file mode 100644 index 4ad6779..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/darwin/ztypes_darwin.go +++ /dev/null @@ -1,187 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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. - -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs defs_darwin.go - -package darwin - -type processState uint32 - -const ( - stateSIDL processState = iota + 1 - stateRun - stateSleep - stateStop - stateZombie -) - -const argMax = 0x40000 - -type bsdInfo struct { - Pbi_flags uint32 - Pbi_status uint32 - Pbi_xstatus uint32 - Pbi_pid uint32 - Pbi_ppid uint32 - Pbi_uid uint32 - Pbi_gid uint32 - Pbi_ruid uint32 - Pbi_rgid uint32 - Pbi_svuid uint32 - Pbi_svgid uint32 - Rfu_1 uint32 - Pbi_comm [16]int8 - Pbi_name [32]int8 - Pbi_nfiles uint32 - Pbi_pgid uint32 - Pbi_pjobc uint32 - E_tdev uint32 - E_tpgid uint32 - Pbi_nice int32 - Pbi_start_tvsec uint64 - Pbi_start_tvusec uint64 -} - -type procTaskInfo struct { - Virtual_size uint64 - Resident_size uint64 - Total_user uint64 - Total_system uint64 - Threads_user uint64 - Threads_system uint64 - Policy int32 - Faults int32 - Pageins int32 - Cow_faults int32 - Messages_sent int32 - Messages_received int32 - Syscalls_mach int32 - Syscalls_unix int32 - Csw int32 - Threadnum int32 - Numrunning int32 - Priority int32 -} - -type procTaskAllInfo struct { - Pbsd bsdInfo - Ptinfo procTaskInfo -} - -type vinfoStat struct { - Dev uint32 - Mode uint16 - Nlink uint16 - Ino uint64 - Uid uint32 - Gid uint32 - Atime int64 - Atimensec int64 - Mtime int64 - Mtimensec int64 - Ctime int64 - Ctimensec int64 - Birthtime int64 - Birthtimensec int64 - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Rdev uint32 - Qspare [2]int64 -} - -type fsid struct { - Val [2]int32 -} - -type vnodeInfo struct { - Stat vinfoStat - Type int32 - Pad int32 - Fsid fsid -} - -type vnodeInfoPath struct { - Vi vnodeInfo - Path [1024]int8 -} - -type procVnodePathInfo struct { - Cdir vnodeInfoPath - Rdir vnodeInfoPath -} - -type vmStatisticsData struct { - Free_count uint32 - Active_count uint32 - Inactive_count uint32 - Wire_count uint32 - Zero_fill_count uint32 - Reactivations uint32 - Pageins uint32 - Pageouts uint32 - Faults uint32 - Cow_faults uint32 - Lookups uint32 - Hits uint32 - Purgeable_count uint32 - Purges uint32 - Speculative_count uint32 -} - -type vmStatistics64Data struct { - Free_count uint32 - Active_count uint32 - Inactive_count uint32 - Wire_count uint32 - Zero_fill_count uint64 - Reactivations uint64 - Pageins uint64 - Pageouts uint64 - Faults uint64 - Cow_faults uint64 - Lookups uint64 - Hits uint64 - Purges uint64 - Purgeable_count uint32 - Speculative_count uint32 - Decompressions uint64 - Compressions uint64 - Swapins uint64 - Swapouts uint64 - Compressor_page_count uint32 - Throttled_count uint32 - External_page_count uint32 - Internal_page_count uint32 - Total_uncompressed_pages_in_compressor uint64 -} - -type vmSize uint64 - -const ( - cpuStateUser = 0x0 - cpuStateSystem = 0x1 - cpuStateIdle = 0x2 - cpuStateNice = 0x3 -) - -type hostCPULoadInfo struct { - Ticks [4]uint32 -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/linux/arch_linux.go b/vendor/github.com/elastic/go-sysinfo/providers/linux/arch_linux.go deleted file mode 100644 index e1d2893..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/linux/arch_linux.go +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 linux - -import ( - "fmt" - "syscall" -) - -func Architecture() (string, error) { - var uname syscall.Utsname - if err := syscall.Uname(&uname); err != nil { - return "", fmt.Errorf("architecture: %w", err) - } - - data := make([]byte, 0, len(uname.Machine)) - for _, v := range uname.Machine { - if v == 0 { - break - } - data = append(data, byte(v)) - } - - return string(data), nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/linux/boottime_linux.go b/vendor/github.com/elastic/go-sysinfo/providers/linux/boottime_linux.go deleted file mode 100644 index e229d54..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/linux/boottime_linux.go +++ /dev/null @@ -1,47 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 linux - -import ( - "sync" - "time" - - "github.com/prometheus/procfs" -) - -var ( - bootTimeValue time.Time // Cached boot time. - bootTimeLock sync.Mutex // Lock that guards access to bootTime. -) - -func bootTime(fs procfs.FS) (time.Time, error) { - bootTimeLock.Lock() - defer bootTimeLock.Unlock() - - if !bootTimeValue.IsZero() { - return bootTimeValue, nil - } - - stat, err := fs.NewStat() - if err != nil { - return time.Time{}, err - } - - bootTimeValue = time.Unix(int64(stat.BootTime), 0) - return bootTimeValue, nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/linux/capabilities_linux.go b/vendor/github.com/elastic/go-sysinfo/providers/linux/capabilities_linux.go deleted file mode 100644 index 0b53d75..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/linux/capabilities_linux.go +++ /dev/null @@ -1,118 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 linux - -import ( - "strconv" - - "github.com/elastic/go-sysinfo/types" -) - -// capabilityNames is mapping of capability constant values to names. -// -// Generated with: -// -// curl -s https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/capability.h | \ -// grep -P '^#define CAP_\w+\s+\d+' | perl -pe 's/#define (\w+)\s+(\d+)/\2: "\1",/g' -var capabilityNames = map[int]string{ - 0: "chown", - 1: "dac_override", - 2: "dac_read_search", - 3: "fowner", - 4: "fsetid", - 5: "kill", - 6: "setgid", - 7: "setuid", - 8: "setpcap", - 9: "linux_immutable", - 10: "net_bind_service", - 11: "net_broadcast", - 12: "net_admin", - 13: "net_raw", - 14: "ipc_lock", - 15: "ipc_owner", - 16: "sys_module", - 17: "sys_rawio", - 18: "sys_chroot", - 19: "sys_ptrace", - 20: "sys_pacct", - 21: "sys_admin", - 22: "sys_boot", - 23: "sys_nice", - 24: "sys_resource", - 25: "sys_time", - 26: "sys_tty_config", - 27: "mknod", - 28: "lease", - 29: "audit_write", - 30: "audit_control", - 31: "setfcap", - 32: "mac_override", - 33: "mac_admin", - 34: "syslog", - 35: "wake_alarm", - 36: "block_suspend", - 37: "audit_read", -} - -func capabilityName(num int) string { - name, found := capabilityNames[num] - if found { - return name - } - - return strconv.Itoa(num) -} - -func readCapabilities(content []byte) (*types.CapabilityInfo, error) { - var cap types.CapabilityInfo - - err := parseKeyValue(content, ":", func(key, value []byte) error { - var err error - switch string(key) { - case "CapInh": - cap.Inheritable, err = decodeBitMap(string(value), capabilityName) - if err != nil { - return err - } - case "CapPrm": - cap.Permitted, err = decodeBitMap(string(value), capabilityName) - if err != nil { - return err - } - case "CapEff": - cap.Effective, err = decodeBitMap(string(value), capabilityName) - if err != nil { - return err - } - case "CapBnd": - cap.Bounding, err = decodeBitMap(string(value), capabilityName) - if err != nil { - return err - } - case "CapAmb": - cap.Ambient, err = decodeBitMap(string(value), capabilityName) - if err != nil { - return err - } - } - return nil - }) - - return &cap, err -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/linux/container.go b/vendor/github.com/elastic/go-sysinfo/providers/linux/container.go deleted file mode 100644 index 7eee188..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/linux/container.go +++ /dev/null @@ -1,57 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 linux - -import ( - "bufio" - "bytes" - "fmt" - "io/ioutil" - "os" -) - -const procOneCgroup = "/proc/1/cgroup" - -// IsContainerized returns true if this process is containerized. -func IsContainerized() (bool, error) { - data, err := ioutil.ReadFile(procOneCgroup) - if err != nil { - if os.IsNotExist(err) { - return false, nil - } - - return false, fmt.Errorf("failed to read process cgroups: %w", err) - } - - return isContainerizedCgroup(data) -} - -func isContainerizedCgroup(data []byte) (bool, error) { - s := bufio.NewScanner(bytes.NewReader(data)) - for n := 0; s.Scan(); n++ { - line := s.Bytes() - - // Following a suggestion on Stack Overflow on how to detect - // being inside a container: https://stackoverflow.com/a/20012536/235203 - if bytes.Contains(line, []byte("docker")) || bytes.Contains(line, []byte(".slice")) || bytes.Contains(line, []byte("lxc")) || bytes.Contains(line, []byte("kubepods")) { - return true, nil - } - } - - return false, s.Err() -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/linux/doc.go b/vendor/github.com/elastic/go-sysinfo/providers/linux/doc.go deleted file mode 100644 index 53d3c36..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/linux/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 linux implements the HostProvider and ProcessProvider interfaces -// for providing information about Linux. -package linux diff --git a/vendor/github.com/elastic/go-sysinfo/providers/linux/host_linux.go b/vendor/github.com/elastic/go-sysinfo/providers/linux/host_linux.go deleted file mode 100644 index 9adb5cb..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/linux/host_linux.go +++ /dev/null @@ -1,258 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 linux - -import ( - "errors" - "fmt" - "io/ioutil" - "os" - "path/filepath" - "time" - - "github.com/joeshaw/multierror" - "github.com/prometheus/procfs" - - "github.com/elastic/go-sysinfo/internal/registry" - "github.com/elastic/go-sysinfo/providers/shared" - "github.com/elastic/go-sysinfo/types" -) - -func init() { - registry.Register(newLinuxSystem("")) -} - -type linuxSystem struct { - procFS procFS -} - -func newLinuxSystem(hostFS string) linuxSystem { - mountPoint := filepath.Join(hostFS, procfs.DefaultMountPoint) - fs, _ := procfs.NewFS(mountPoint) - return linuxSystem{ - procFS: procFS{FS: fs, mountPoint: mountPoint}, - } -} - -func (s linuxSystem) Host() (types.Host, error) { - return newHost(s.procFS) -} - -type host struct { - procFS procFS - stat procfs.Stat - info types.HostInfo -} - -func (h *host) Info() types.HostInfo { - return h.info -} - -func (h *host) Memory() (*types.HostMemoryInfo, error) { - content, err := ioutil.ReadFile(h.procFS.path("meminfo")) - if err != nil { - return nil, err - } - - return parseMemInfo(content) -} - -// VMStat reports data from /proc/vmstat on linux. -func (h *host) VMStat() (*types.VMStatInfo, error) { - content, err := ioutil.ReadFile(h.procFS.path("vmstat")) - if err != nil { - return nil, err - } - - return parseVMStat(content) -} - -// LoadAverage reports data from /proc/loadavg on linux. -func (h *host) LoadAverage() (*types.LoadAverageInfo, error) { - loadAvg, err := h.procFS.LoadAvg() - if err != nil { - return nil, err - } - - return &types.LoadAverageInfo{ - One: loadAvg.Load1, - Five: loadAvg.Load5, - Fifteen: loadAvg.Load15, - }, nil -} - -// NetworkCounters reports data from /proc/net on linux -func (h *host) NetworkCounters() (*types.NetworkCountersInfo, error) { - snmpRaw, err := ioutil.ReadFile(h.procFS.path("net/snmp")) - if err != nil { - return nil, err - } - snmp, err := getNetSnmpStats(snmpRaw) - if err != nil { - return nil, err - } - - netstatRaw, err := ioutil.ReadFile(h.procFS.path("net/netstat")) - if err != nil { - return nil, err - } - netstat, err := getNetstatStats(netstatRaw) - if err != nil { - return nil, err - } - - return &types.NetworkCountersInfo{SNMP: snmp, Netstat: netstat}, nil -} - -func (h *host) CPUTime() (types.CPUTimes, error) { - stat, err := h.procFS.NewStat() - if err != nil { - return types.CPUTimes{}, err - } - - return types.CPUTimes{ - User: time.Duration(stat.CPUTotal.User * float64(time.Second)), - System: time.Duration(stat.CPUTotal.System * float64(time.Second)), - Idle: time.Duration(stat.CPUTotal.Idle * float64(time.Second)), - IOWait: time.Duration(stat.CPUTotal.Iowait * float64(time.Second)), - IRQ: time.Duration(stat.CPUTotal.IRQ * float64(time.Second)), - Nice: time.Duration(stat.CPUTotal.Nice * float64(time.Second)), - SoftIRQ: time.Duration(stat.CPUTotal.SoftIRQ * float64(time.Second)), - Steal: time.Duration(stat.CPUTotal.Steal * float64(time.Second)), - }, nil -} - -func newHost(fs procFS) (*host, error) { - stat, err := fs.NewStat() - if err != nil { - return nil, fmt.Errorf("failed to read proc stat: %w", err) - } - - h := &host{stat: stat, procFS: fs} - r := &reader{} - r.architecture(h) - r.bootTime(h) - r.containerized(h) - r.hostname(h) - r.network(h) - r.kernelVersion(h) - r.os(h) - r.time(h) - r.uniqueID(h) - return h, r.Err() -} - -type reader struct { - errs []error -} - -func (r *reader) addErr(err error) bool { - if err != nil { - if !errors.Is(err, types.ErrNotImplemented) { - r.errs = append(r.errs, err) - } - return true - } - return false -} - -func (r *reader) Err() error { - if len(r.errs) > 0 { - return &multierror.MultiError{Errors: r.errs} - } - return nil -} - -func (r *reader) architecture(h *host) { - v, err := Architecture() - if r.addErr(err) { - return - } - h.info.Architecture = v -} - -func (r *reader) bootTime(h *host) { - v, err := bootTime(h.procFS.FS) - if r.addErr(err) { - return - } - h.info.BootTime = v -} - -func (r *reader) containerized(h *host) { - v, err := IsContainerized() - if r.addErr(err) { - return - } - h.info.Containerized = &v -} - -func (r *reader) hostname(h *host) { - v, err := os.Hostname() - if r.addErr(err) { - return - } - h.info.Hostname = v -} - -func (r *reader) network(h *host) { - ips, macs, err := shared.Network() - if r.addErr(err) { - return - } - h.info.IPs = ips - h.info.MACs = macs -} - -func (r *reader) kernelVersion(h *host) { - v, err := KernelVersion() - if r.addErr(err) { - return - } - h.info.KernelVersion = v -} - -func (r *reader) os(h *host) { - v, err := OperatingSystem() - if r.addErr(err) { - return - } - h.info.OS = v -} - -func (r *reader) time(h *host) { - h.info.Timezone, h.info.TimezoneOffsetSec = time.Now().Zone() -} - -func (r *reader) uniqueID(h *host) { - v, err := MachineID() - if r.addErr(err) { - return - } - h.info.UniqueID = v -} - -type procFS struct { - procfs.FS - mountPoint string -} - -func (fs *procFS) path(p ...string) string { - elem := append([]string{fs.mountPoint}, p...) - return filepath.Join(elem...) -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/linux/kernel_linux.go b/vendor/github.com/elastic/go-sysinfo/providers/linux/kernel_linux.go deleted file mode 100644 index 1695fb8..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/linux/kernel_linux.go +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 linux - -import ( - "fmt" - "syscall" -) - -func KernelVersion() (string, error) { - var uname syscall.Utsname - if err := syscall.Uname(&uname); err != nil { - return "", fmt.Errorf("kernel version: %w", err) - } - - data := make([]byte, 0, len(uname.Release)) - for _, v := range uname.Release { - if v == 0 { - break - } - data = append(data, byte(v)) - } - - return string(data), nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/linux/machineid.go b/vendor/github.com/elastic/go-sysinfo/providers/linux/machineid.go deleted file mode 100644 index adfcd10..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/linux/machineid.go +++ /dev/null @@ -1,60 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 linux - -import ( - "bytes" - "fmt" - "io/ioutil" - "os" - - "github.com/elastic/go-sysinfo/types" -) - -// Possible (current and historic) locations of the machine-id file. -// These will be searched in order. -var machineIDFiles = []string{"/etc/machine-id", "/var/lib/dbus/machine-id", "/var/db/dbus/machine-id"} - -func MachineID() (string, error) { - var contents []byte - var err error - - for _, file := range machineIDFiles { - contents, err = ioutil.ReadFile(file) - if err != nil { - if os.IsNotExist(err) { - // Try next location - continue - } - - // Return with error on any other error - return "", fmt.Errorf("failed to read %v: %w", file, err) - } - - // Found it - break - } - - if os.IsNotExist(err) { - // None of the locations existed - return "", types.ErrNotImplemented - } - - contents = bytes.TrimSpace(contents) - return string(contents), nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/linux/memory_linux.go b/vendor/github.com/elastic/go-sysinfo/providers/linux/memory_linux.go deleted file mode 100644 index c04bad0..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/linux/memory_linux.go +++ /dev/null @@ -1,72 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 linux - -import ( - "fmt" - - "github.com/elastic/go-sysinfo/types" -) - -func parseMemInfo(content []byte) (*types.HostMemoryInfo, error) { - memInfo := &types.HostMemoryInfo{ - Metrics: map[string]uint64{}, - } - - hasAvailable := false - err := parseKeyValue(content, ":", func(key, value []byte) error { - num, err := parseBytesOrNumber(value) - if err != nil { - return fmt.Errorf("failed to parse %v value of %v: %w", string(key), string(value), err) - } - - k := string(key) - switch k { - case "MemTotal": - memInfo.Total = num - case "MemAvailable": - hasAvailable = true - memInfo.Available = num - case "MemFree": - memInfo.Free = num - case "SwapTotal": - memInfo.VirtualTotal = num - case "SwapFree": - memInfo.VirtualFree = num - default: - memInfo.Metrics[k] = num - } - - return nil - }) - if err != nil { - return nil, err - } - - memInfo.Used = memInfo.Total - memInfo.Free - memInfo.VirtualUsed = memInfo.VirtualTotal - memInfo.VirtualFree - - // MemAvailable was added in kernel 3.14. - if !hasAvailable { - // Linux uses this for the calculation (but we are using a simpler calculation). - // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773 - memInfo.Available = memInfo.Free + memInfo.Metrics["Buffers"] + memInfo.Metrics["Cached"] - } - - return memInfo, nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/linux/os.go b/vendor/github.com/elastic/go-sysinfo/providers/linux/os.go deleted file mode 100644 index 863234c..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/linux/os.go +++ /dev/null @@ -1,275 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 linux - -import ( - "bufio" - "bytes" - "fmt" - "io/ioutil" - "os" - "path/filepath" - "regexp" - "strconv" - "strings" - - "github.com/joeshaw/multierror" - - "github.com/elastic/go-sysinfo/types" -) - -const ( - osRelease = "/etc/os-release" - lsbRelease = "/etc/lsb-release" - distribRelease = "/etc/*-release" - versionGrok = `(?P(?P[0-9]+)\.?(?P[0-9]+)?\.?(?P\w+)?)(?: \((?P[-\w ]+)\))?` -) - -var ( - // distribReleaseRegexp parses the /etc/-release file. See man lsb-release. - distribReleaseRegexp = regexp.MustCompile(`(?P[\w]+).* ` + versionGrok) - - // versionRegexp parses version numbers (e.g. 6 or 6.1 or 6.1.0 or 6.1.0_20150102). - versionRegexp = regexp.MustCompile(versionGrok) -) - -// familyMap contains a mapping of family -> []platforms. -var familyMap = map[string][]string{ - "redhat": {"redhat", "fedora", "centos", "scientific", "oraclelinux", "ol", - "amzn", "rhel", "almalinux", "openeuler", "rocky"}, - "debian": {"debian", "ubuntu", "raspbian", "linuxmint"}, - "suse": {"suse", "sles", "opensuse"}, -} - -var platformToFamilyMap map[string]string - -func init() { - platformToFamilyMap = map[string]string{} - for family, platformList := range familyMap { - for _, platform := range platformList { - platformToFamilyMap[platform] = family - } - } -} - -func OperatingSystem() (*types.OSInfo, error) { - return getOSInfo("") -} - -func getOSInfo(baseDir string) (*types.OSInfo, error) { - osInfo, err := getOSRelease(baseDir) - if err != nil { - // Fallback - return findDistribRelease(baseDir) - } - - // For the redhat family, enrich version info with data from - // /etc/[distrib]-release because the minor and patch info isn't always - // present in os-release. - if osInfo.Family != "redhat" { - return osInfo, nil - } - - distInfo, err := findDistribRelease(baseDir) - if err != nil { - return osInfo, err - } - osInfo.Major = distInfo.Major - osInfo.Minor = distInfo.Minor - osInfo.Patch = distInfo.Patch - osInfo.Codename = distInfo.Codename - return osInfo, nil -} - -func getOSRelease(baseDir string) (*types.OSInfo, error) { - lsbRel, _ := ioutil.ReadFile(filepath.Join(baseDir, lsbRelease)) - - osRel, err := ioutil.ReadFile(filepath.Join(baseDir, osRelease)) - if err != nil { - return nil, err - } - if len(osRel) == 0 { - return nil, fmt.Errorf("%v is empty: %w", osRelease, err) - } - - return parseOSRelease(append(lsbRel, osRel...)) -} - -func parseOSRelease(content []byte) (*types.OSInfo, error) { - fields := map[string]string{} - - s := bufio.NewScanner(bytes.NewReader(content)) - for s.Scan() { - line := bytes.TrimSpace(s.Bytes()) - - // Skip blank lines and comments. - if len(line) == 0 || bytes.HasPrefix(line, []byte("#")) { - continue - } - - parts := bytes.SplitN(s.Bytes(), []byte("="), 2) - if len(parts) != 2 { - continue - } - - key := string(bytes.TrimSpace(parts[0])) - val := string(bytes.TrimSpace(parts[1])) - fields[key] = val - - // Trim quotes. - val, err := strconv.Unquote(val) - if err == nil { - fields[key] = strings.TrimSpace(val) - } - } - - if s.Err() != nil { - return nil, s.Err() - } - - return makeOSInfo(fields) -} - -func makeOSInfo(osRelease map[string]string) (*types.OSInfo, error) { - os := &types.OSInfo{ - Type: "linux", - Platform: osRelease["ID"], - Name: osRelease["NAME"], - Version: osRelease["VERSION"], - Build: osRelease["BUILD_ID"], - Codename: osRelease["VERSION_CODENAME"], - } - - if os.Codename == "" { - // Some OSes uses their own CODENAME keys (e.g UBUNTU_CODENAME) or we - // can get the DISTRIB_CODENAME value from the lsb-release data. - for k, v := range osRelease { - if strings.Contains(k, "CODENAME") { - os.Codename = v - break - } - } - } - - if os.Platform == "" { - // Fallback to the first word of the NAME field. - parts := strings.SplitN(os.Name, " ", 2) - if len(parts) > 0 { - os.Platform = strings.ToLower(parts[0]) - } - } - - if os.Version != "" { - // Try parsing info from the version. - keys := versionRegexp.SubexpNames() - for i, m := range versionRegexp.FindStringSubmatch(os.Version) { - switch keys[i] { - case "major": - os.Major, _ = strconv.Atoi(m) - case "minor": - os.Minor, _ = strconv.Atoi(m) - case "patch": - os.Patch, _ = strconv.Atoi(m) - case "codename": - if os.Codename == "" { - os.Codename = m - } - } - } - } - - os.Family = platformToFamilyMap[strings.ToLower(os.Platform)] - return os, nil -} - -func findDistribRelease(baseDir string) (*types.OSInfo, error) { - var errs []error - matches, err := filepath.Glob(filepath.Join(baseDir, distribRelease)) - if err != nil { - return nil, err - } - for _, path := range matches { - if strings.HasSuffix(path, osRelease) || strings.HasSuffix(path, lsbRelease) { - continue - } - - info, err := os.Stat(path) - if err != nil || info.IsDir() || info.Size() == 0 { - continue - } - - osInfo, err := getDistribRelease(path) - if err != nil { - errs = append(errs, fmt.Errorf("in %s: %w", path, err)) - continue - } - return osInfo, err - } - return nil, fmt.Errorf("no valid /etc/-release file found: %w", &multierror.MultiError{Errors: errs}) -} - -func getDistribRelease(file string) (*types.OSInfo, error) { - data, err := ioutil.ReadFile(file) - if err != nil { - return nil, err - } - parts := bytes.SplitN(data, []byte("\n"), 2) - if len(parts) != 2 { - return nil, fmt.Errorf("failed to parse %v", file) - } - - // Use distrib as platform name. - var platform string - if parts := strings.SplitN(filepath.Base(file), "-", 2); len(parts) > 0 { - platform = strings.ToLower(parts[0]) - } - - return parseDistribRelease(platform, parts[0]) -} - -func parseDistribRelease(platform string, content []byte) (*types.OSInfo, error) { - var ( - line = string(bytes.TrimSpace(content)) - keys = distribReleaseRegexp.SubexpNames() - os = &types.OSInfo{ - Type: "linux", - Platform: platform, - } - ) - - for i, m := range distribReleaseRegexp.FindStringSubmatch(line) { - switch keys[i] { - case "name": - os.Name = m - case "version": - os.Version = m - case "major": - os.Major, _ = strconv.Atoi(m) - case "minor": - os.Minor, _ = strconv.Atoi(m) - case "patch": - os.Patch, _ = strconv.Atoi(m) - case "codename": - os.Version += " (" + m + ")" - os.Codename = m - } - } - - os.Family = platformToFamilyMap[strings.ToLower(os.Platform)] - return os, nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/linux/process_linux.go b/vendor/github.com/elastic/go-sysinfo/providers/linux/process_linux.go deleted file mode 100644 index 10cb947..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/linux/process_linux.go +++ /dev/null @@ -1,282 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 linux - -import ( - "bytes" - "io/ioutil" - "os" - "strconv" - "strings" - "time" - - "github.com/prometheus/procfs" - - "github.com/elastic/go-sysinfo/types" -) - -const userHz = 100 - -func (s linuxSystem) Processes() ([]types.Process, error) { - procs, err := s.procFS.AllProcs() - if err != nil { - return nil, err - } - - processes := make([]types.Process, 0, len(procs)) - for _, proc := range procs { - processes = append(processes, &process{Proc: proc, fs: s.procFS}) - } - return processes, nil -} - -func (s linuxSystem) Process(pid int) (types.Process, error) { - proc, err := s.procFS.NewProc(pid) - if err != nil { - return nil, err - } - - return &process{Proc: proc, fs: s.procFS}, nil -} - -func (s linuxSystem) Self() (types.Process, error) { - proc, err := s.procFS.Self() - if err != nil { - return nil, err - } - - return &process{Proc: proc, fs: s.procFS}, nil -} - -type process struct { - procfs.Proc - fs procFS - info *types.ProcessInfo -} - -func (p *process) PID() int { - return p.Proc.PID -} - -func (p *process) Parent() (types.Process, error) { - info, err := p.Info() - if err != nil { - return nil, err - } - - proc, err := p.fs.NewProc(info.PPID) - if err != nil { - return nil, err - } - - return &process{Proc: proc, fs: p.fs}, nil -} - -func (p *process) path(pa ...string) string { - return p.fs.path(append([]string{strconv.Itoa(p.PID())}, pa...)...) -} - -func (p *process) CWD() (string, error) { - // TODO: add CWD to procfs - cwd, err := os.Readlink(p.path("cwd")) - if os.IsNotExist(err) { - return "", nil - } - - return cwd, err -} - -func (p *process) Info() (types.ProcessInfo, error) { - if p.info != nil { - return *p.info, nil - } - - stat, err := p.NewStat() - if err != nil { - return types.ProcessInfo{}, err - } - - exe, err := p.Executable() - if err != nil { - return types.ProcessInfo{}, err - } - - args, err := p.CmdLine() - if err != nil { - return types.ProcessInfo{}, err - } - - cwd, err := p.CWD() - if err != nil { - return types.ProcessInfo{}, err - } - - bootTime, err := bootTime(p.fs.FS) - if err != nil { - return types.ProcessInfo{}, err - } - - p.info = &types.ProcessInfo{ - Name: stat.Comm, - PID: p.PID(), - PPID: stat.PPID, - CWD: cwd, - Exe: exe, - Args: args, - StartTime: bootTime.Add(ticksToDuration(stat.Starttime)), - } - - return *p.info, nil -} - -func (p *process) Memory() (types.MemoryInfo, error) { - stat, err := p.NewStat() - if err != nil { - return types.MemoryInfo{}, err - } - - return types.MemoryInfo{ - Resident: uint64(stat.ResidentMemory()), - Virtual: uint64(stat.VirtualMemory()), - }, nil -} - -func (p *process) CPUTime() (types.CPUTimes, error) { - stat, err := p.NewStat() - if err != nil { - return types.CPUTimes{}, err - } - - return types.CPUTimes{ - User: ticksToDuration(uint64(stat.UTime)), - System: ticksToDuration(uint64(stat.STime)), - }, nil -} - -// OpenHandles returns the list of open file descriptors of the process. -func (p *process) OpenHandles() ([]string, error) { - return p.Proc.FileDescriptorTargets() -} - -// OpenHandles returns the number of open file descriptors of the process. -func (p *process) OpenHandleCount() (int, error) { - return p.Proc.FileDescriptorsLen() -} - -func (p *process) Environment() (map[string]string, error) { - // TODO: add Environment to procfs - content, err := ioutil.ReadFile(p.path("environ")) - if err != nil { - return nil, err - } - - env := map[string]string{} - pairs := bytes.Split(content, []byte{0}) - for _, kv := range pairs { - parts := bytes.SplitN(kv, []byte{'='}, 2) - if len(parts) != 2 { - continue - } - - key := string(bytes.TrimSpace(parts[0])) - if key == "" { - continue - } - - env[key] = string(parts[1]) - } - - return env, nil -} - -func (p *process) Seccomp() (*types.SeccompInfo, error) { - content, err := ioutil.ReadFile(p.path("status")) - if err != nil { - return nil, err - } - - return readSeccompFields(content) -} - -func (p *process) Capabilities() (*types.CapabilityInfo, error) { - content, err := ioutil.ReadFile(p.path("status")) - if err != nil { - return nil, err - } - - return readCapabilities(content) -} - -func (p *process) User() (types.UserInfo, error) { - content, err := ioutil.ReadFile(p.path("status")) - if err != nil { - return types.UserInfo{}, err - } - - var user types.UserInfo - err = parseKeyValue(content, ":", func(key, value []byte) error { - // See proc(5) for the format of /proc/[pid]/status - switch string(key) { - case "Uid": - ids := strings.Split(string(value), "\t") - if len(ids) >= 3 { - user.UID = ids[0] - user.EUID = ids[1] - user.SUID = ids[2] - } - case "Gid": - ids := strings.Split(string(value), "\t") - if len(ids) >= 3 { - user.GID = ids[0] - user.EGID = ids[1] - user.SGID = ids[2] - } - } - return nil - }) - - return user, nil -} - -// NetworkStats reports network stats for an individual PID. -func (p *process) NetworkCounters() (*types.NetworkCountersInfo, error) { - snmpRaw, err := ioutil.ReadFile(p.path("net/snmp")) - if err != nil { - return nil, err - } - snmp, err := getNetSnmpStats(snmpRaw) - if err != nil { - return nil, err - } - - netstatRaw, err := ioutil.ReadFile(p.path("net/netstat")) - if err != nil { - return nil, err - } - netstat, err := getNetstatStats(netstatRaw) - if err != nil { - return nil, err - } - - return &types.NetworkCountersInfo{SNMP: snmp, Netstat: netstat}, nil -} - -func ticksToDuration(ticks uint64) time.Duration { - seconds := float64(ticks) / float64(userHz) * float64(time.Second) - return time.Duration(int64(seconds)) -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/linux/procnet.go b/vendor/github.com/elastic/go-sysinfo/providers/linux/procnet.go deleted file mode 100644 index 1356c2a..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/linux/procnet.go +++ /dev/null @@ -1,127 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 linux - -import ( - "errors" - "fmt" - "reflect" - "strconv" - "strings" - - "github.com/elastic/go-sysinfo/types" -) - -// fillStruct is some reflection work that can dynamically fill one of our tagged `netstat` structs with netstat data -func fillStruct(str interface{}, data map[string]map[string]uint64) { - val := reflect.ValueOf(str).Elem() - typ := reflect.TypeOf(str).Elem() - - for i := 0; i < typ.NumField(); i++ { - field := typ.Field(i) - if tag := field.Tag.Get("netstat"); tag != "" { - if values, ok := data[tag]; ok { - val.Field(i).Set(reflect.ValueOf(values)) - } - } - } -} - -// parseEntry parses two lines from the net files, the first line being keys, the second being values -func parseEntry(line1, line2 string) (map[string]uint64, error) { - keyArr := strings.Split(strings.TrimSpace(line1), " ") - valueArr := strings.Split(strings.TrimSpace(line2), " ") - - if len(keyArr) != len(valueArr) { - return nil, errors.New("key and value lines are mismatched") - } - - counters := make(map[string]uint64, len(valueArr)) - for iter, value := range valueArr { - - // This if-else block is to deal with the MaxConn value in SNMP, - // which is a signed value according to RFC2012. - // This library emulates the behavior of the kernel: store all values as a uint, then cast to a signed value for printing - // Users of this library need to be aware that this value should be printed as a signed int or hex value to make it useful. - var parsed uint64 - var err error - if strings.Contains(value, "-") { - signedParsed, err := strconv.ParseInt(value, 10, 64) - if err != nil { - return nil, fmt.Errorf("error parsing string to int in line: %#v: %w", valueArr, err) - } - parsed = uint64(signedParsed) - } else { - parsed, err = strconv.ParseUint(value, 10, 64) - if err != nil { - return nil, fmt.Errorf("error parsing string to int in line: %#v: %w", valueArr, err) - } - } - - counters[keyArr[iter]] = parsed - } - return counters, nil -} - -// parseNetFile parses an entire file, and returns a 2D map, representing how files are sorted by protocol -func parseNetFile(body string) (map[string]map[string]uint64, error) { - fileMetrics := make(map[string]map[string]uint64) - bodySplit := strings.Split(strings.TrimSpace(body), "\n") - // There should be an even number of lines. If not, something is wrong. - if len(bodySplit)%2 != 0 { - return nil, fmt.Errorf("badly parsed body: %s", body) - } - // in the network counters, data is divided into two-line sections: a line of keys, and a line of values - // With each line - for index := 0; index < len(bodySplit); index += 2 { - keysSplit := strings.Split(bodySplit[index], ":") - valuesSplit := strings.Split(bodySplit[index+1], ":") - if len(keysSplit) != 2 || len(valuesSplit) != 2 { - return nil, fmt.Errorf("wrong number of keys: %#v", keysSplit) - } - valMap, err := parseEntry(keysSplit[1], valuesSplit[1]) - if err != nil { - return nil, fmt.Errorf("error parsing lines: %w", err) - } - fileMetrics[valuesSplit[0]] = valMap - } - return fileMetrics, nil -} - -// getNetSnmpStats pulls snmp stats from /proc/net -func getNetSnmpStats(raw []byte) (types.SNMP, error) { - snmpData, err := parseNetFile(string(raw)) - if err != nil { - return types.SNMP{}, fmt.Errorf("error parsing SNMP: %w", err) - } - output := types.SNMP{} - fillStruct(&output, snmpData) - - return output, nil -} - -// getNetstatStats pulls netstat stats from /proc/net -func getNetstatStats(raw []byte) (types.Netstat, error) { - netstatData, err := parseNetFile(string(raw)) - if err != nil { - return types.Netstat{}, fmt.Errorf("error parsing netstat: %w", err) - } - output := types.Netstat{} - fillStruct(&output, netstatData) - return output, nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/linux/seccomp_linux.go b/vendor/github.com/elastic/go-sysinfo/providers/linux/seccomp_linux.go deleted file mode 100644 index d04bb3c..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/linux/seccomp_linux.go +++ /dev/null @@ -1,69 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 linux - -import ( - "strconv" - - "github.com/elastic/go-sysinfo/types" -) - -type SeccompMode uint8 - -const ( - SeccompModeDisabled SeccompMode = iota - SeccompModeStrict - SeccompModeFilter -) - -func (m SeccompMode) String() string { - switch m { - case SeccompModeDisabled: - return "disabled" - case SeccompModeStrict: - return "strict" - case SeccompModeFilter: - return "filter" - default: - return strconv.Itoa(int(m)) - } -} - -func readSeccompFields(content []byte) (*types.SeccompInfo, error) { - var seccomp types.SeccompInfo - - err := parseKeyValue(content, ":", func(key, value []byte) error { - switch string(key) { - case "Seccomp": - mode, err := strconv.ParseUint(string(value), 10, 8) - if err != nil { - return err - } - seccomp.Mode = SeccompMode(mode).String() - case "NoNewPrivs": - noNewPrivs, err := strconv.ParseBool(string(value)) - if err != nil { - return err - } - seccomp.NoNewPrivs = &noNewPrivs - } - return nil - }) - - return &seccomp, err -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/linux/util.go b/vendor/github.com/elastic/go-sysinfo/providers/linux/util.go deleted file mode 100644 index b8705a1..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/linux/util.go +++ /dev/null @@ -1,111 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 linux - -import ( - "bufio" - "bytes" - "errors" - "fmt" - "io/ioutil" - "strconv" -) - -func parseKeyValue(content []byte, separator string, callback func(key, value []byte) error) error { - sc := bufio.NewScanner(bytes.NewReader(content)) - for sc.Scan() { - parts := bytes.SplitN(sc.Bytes(), []byte(separator), 2) - if len(parts) != 2 { - continue - } - - if err := callback(parts[0], bytes.TrimSpace(parts[1])); err != nil { - return err - } - } - - return sc.Err() -} - -func findValue(filename, separator, key string) (string, error) { - content, err := ioutil.ReadFile(filename) - if err != nil { - return "", err - } - - var line []byte - sc := bufio.NewScanner(bytes.NewReader(content)) - for sc.Scan() { - if bytes.HasPrefix(sc.Bytes(), []byte(key)) { - line = sc.Bytes() - break - } - } - if len(line) == 0 { - return "", fmt.Errorf("%v not found", key) - } - - parts := bytes.SplitN(line, []byte(separator), 2) - if len(parts) != 2 { - return "", fmt.Errorf("unexpected line format for '%v'", string(line)) - } - - return string(bytes.TrimSpace(parts[1])), nil -} - -func decodeBitMap(s string, lookupName func(int) string) ([]string, error) { - mask, err := strconv.ParseUint(s, 16, 64) - if err != nil { - return nil, err - } - - var names []string - for i := 0; i < 64; i++ { - bit := mask & (1 << uint(i)) - if bit > 0 { - names = append(names, lookupName(i)) - } - } - - return names, nil -} - -func parseBytesOrNumber(data []byte) (uint64, error) { - parts := bytes.Fields(data) - - if len(parts) == 0 { - return 0, errors.New("empty value") - } - - num, err := strconv.ParseUint(string(parts[0]), 10, 64) - if err != nil { - return 0, fmt.Errorf("failed to parse value: %w", err) - } - - var multiplier uint64 = 1 - if len(parts) >= 2 { - switch string(parts[1]) { - case "kB": - multiplier = 1024 - default: - return 0, fmt.Errorf("unhandled unit %v", string(parts[1])) - } - } - - return num * multiplier, nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/linux/vmstat.go b/vendor/github.com/elastic/go-sysinfo/providers/linux/vmstat.go deleted file mode 100644 index 2b9e878..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/linux/vmstat.go +++ /dev/null @@ -1,69 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 linux - -import ( - "fmt" - "reflect" - - "github.com/elastic/go-sysinfo/types" -) - -// vmstatTagToFieldIndex contains a mapping of json struct tags to struct field indices. -var vmstatTagToFieldIndex = make(map[string]int) - -func init() { - var vmstat types.VMStatInfo - val := reflect.ValueOf(vmstat) - typ := reflect.TypeOf(vmstat) - - for i := 0; i < val.NumField(); i++ { - field := typ.Field(i) - if tag := field.Tag.Get("json"); tag != "" { - vmstatTagToFieldIndex[tag] = i - } - } -} - -// parseVMStat parses the contents of /proc/vmstat. -func parseVMStat(content []byte) (*types.VMStatInfo, error) { - var vmStat types.VMStatInfo - refValues := reflect.ValueOf(&vmStat).Elem() - - err := parseKeyValue(content, " ", func(key, value []byte) error { - // turn our []byte value into an int - val, err := parseBytesOrNumber(value) - if err != nil { - return fmt.Errorf("failed to parse %v value of %v: %w", string(key), string(value), err) - } - - idx, ok := vmstatTagToFieldIndex[string(key)] - if !ok { - return nil - } - - sval := refValues.Field(idx) - - if sval.CanSet() { - sval.SetUint(val) - } - return nil - }) - - return &vmStat, err -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/shared/network.go b/vendor/github.com/elastic/go-sysinfo/providers/shared/network.go deleted file mode 100644 index cd11acd..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/shared/network.go +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 shared - -import ( - "net" -) - -func Network() (ips, macs []string, err error) { - ifcs, err := net.Interfaces() - if err != nil { - return nil, nil, err - } - - ips = make([]string, 0, len(ifcs)) - macs = make([]string, 0, len(ifcs)) - for _, ifc := range ifcs { - addrs, err := ifc.Addrs() - if err != nil { - return nil, nil, err - } - for _, addr := range addrs { - ips = append(ips, addr.String()) - } - - mac := ifc.HardwareAddr.String() - if mac != "" { - macs = append(macs, mac) - } - } - - return ips, macs, nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/windows/arch_windows.go b/vendor/github.com/elastic/go-sysinfo/providers/windows/arch_windows.go deleted file mode 100644 index 0edfc4d..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/windows/arch_windows.go +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 windows - -import ( - windows "github.com/elastic/go-windows" -) - -func Architecture() (string, error) { - systemInfo, err := windows.GetNativeSystemInfo() - if err != nil { - return "", err - } - - return systemInfo.ProcessorArchitecture.String(), nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/windows/boottime_windows.go b/vendor/github.com/elastic/go-sysinfo/providers/windows/boottime_windows.go deleted file mode 100644 index e04d9a4..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/windows/boottime_windows.go +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 windows - -import ( - "time" - - "golang.org/x/sys/windows" -) - -func BootTime() (time.Time, error) { - bootTime := time.Now().Add(-1 * windows.DurationSinceBoot()) - - // According to GetTickCount64, the resolution of the value is limited to - // the resolution of the system timer, which is typically in the range of - // 10 milliseconds to 16 milliseconds. So this will round the value to the - // nearest second to not mislead anyone about the precision of the value - // and to provide a stable value. - bootTime = bootTime.Round(time.Second) - return bootTime, nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/windows/device_windows.go b/vendor/github.com/elastic/go-sysinfo/providers/windows/device_windows.go deleted file mode 100644 index 372f125..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/windows/device_windows.go +++ /dev/null @@ -1,193 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 windows - -import ( - "errors" - "fmt" - "strings" - "unsafe" - - "golang.org/x/sys/windows" -) - -const ( - // DeviceMup is the device used for unmounted network filesystems - DeviceMup = "\\device\\mup" - - // LANManRedirector is an string that appears in mounted network filesystems - LANManRedirector = "lanmanredirector" -) - -var ( - // ErrNoDevice is the error returned by DevicePathToDrivePath when - // an invalid device-path is supplied. - ErrNoDevice = errors.New("not a device path") - - // ErrDeviceNotFound is the error returned by DevicePathToDrivePath when - // a path pointing to an unmapped device is passed. - ErrDeviceNotFound = errors.New("logical device not found") -) - -type deviceProvider interface { - GetLogicalDrives() (uint32, error) - QueryDosDevice(*uint16, *uint16, uint32) (uint32, error) -} - -type deviceMapper struct { - deviceProvider -} - -type winapiDeviceProvider struct{} - -type testingDeviceProvider map[byte]string - -func newDeviceMapper() deviceMapper { - return deviceMapper{ - deviceProvider: winapiDeviceProvider{}, - } -} - -func fixNetworkDrivePath(device string) string { - // For a VirtualBox share: - // device=\device\vboxminirdr\;z:\vboxsvr\share - // path=\device\vboxminirdr\vboxsvr\share - // - // For a network share: - // device=\device\lanmanredirector\;q:nnnnnnn\server\share - // path=\device\mup\server\share - - semicolonPos := strings.IndexByte(device, ';') - colonPos := strings.IndexByte(device, ':') - if semicolonPos == -1 || colonPos != semicolonPos+2 { - return device - } - pathStart := strings.IndexByte(device[colonPos+1:], '\\') - if pathStart == -1 { - return device - } - dev := device[:semicolonPos] - path := device[colonPos+pathStart+1:] - n := len(dev) - if n > 0 && dev[n-1] == '\\' { - dev = dev[:n-1] - } - return dev + path -} - -func (mapper *deviceMapper) getDevice(driveLetter byte) (string, error) { - driveBuf := [3]uint16{uint16(driveLetter), ':', 0} - - for bufSize := 64; bufSize <= 1024; bufSize *= 2 { - deviceBuf := make([]uint16, bufSize) - n, err := mapper.QueryDosDevice(&driveBuf[0], &deviceBuf[0], uint32(len(deviceBuf))) - if err != nil { - if err == windows.ERROR_INSUFFICIENT_BUFFER { - continue - } - return "", err - } - return windows.UTF16ToString(deviceBuf[:n]), nil - } - return "", windows.ERROR_INSUFFICIENT_BUFFER -} - -func (mapper *deviceMapper) DevicePathToDrivePath(path string) (string, error) { - pathLower := strings.ToLower(path) - isMUP := strings.Index(pathLower, DeviceMup) == 0 - mask, err := mapper.GetLogicalDrives() - if err != nil { - return "", fmt.Errorf("GetLogicalDrives: %w", err) - } - - for bit := uint32(0); mask != 0 && bit < uint32('Z'-'A'+1); bit++ { - if mask&(1< \\server\share\path - if isMUP { - return "\\" + path[len(DeviceMup):], nil - } - return "", ErrDeviceNotFound -} - -func (winapiDeviceProvider) GetLogicalDrives() (uint32, error) { - return windows.GetLogicalDrives() -} - -func (winapiDeviceProvider) QueryDosDevice(name *uint16, buf *uint16, length uint32) (uint32, error) { - return windows.QueryDosDevice(name, buf, length) -} - -func (m testingDeviceProvider) GetLogicalDrives() (mask uint32, err error) { - for drive := range m { - mask |= 1 << uint32(drive-'A') - } - return mask, nil -} - -func ptrOffset(ptr *uint16, off uint32) *uint16 { - return (*uint16)(unsafe.Pointer(uintptr(unsafe.Pointer(ptr)) + uintptr(off*2))) -} - -func (m testingDeviceProvider) QueryDosDevice(nameW *uint16, buf *uint16, length uint32) (uint32, error) { - drive := byte(*nameW) - if byte(*ptrOffset(nameW, 1)) != ':' { - return 0, errors.New("not a drive") - } - if *ptrOffset(nameW, 2) != 0 { - return 0, errors.New("drive not terminated") - } - path, ok := m[drive] - if !ok { - return 0, fmt.Errorf("drive %c not found", drive) - } - n := uint32(len(path)) - if n+2 > length { - return 0, windows.ERROR_INSUFFICIENT_BUFFER - } - for i := uint32(0); i < n; i++ { - *ptrOffset(buf, i) = uint16(path[i]) - } - *ptrOffset(buf, n) = 0 - *ptrOffset(buf, n+1) = 0 - return n + 2, nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/windows/doc.go b/vendor/github.com/elastic/go-sysinfo/providers/windows/doc.go deleted file mode 100644 index fa35194..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/windows/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 windows implements the HostProvider and ProcessProvider interfaces -// for providing information about Windows. -package windows diff --git a/vendor/github.com/elastic/go-sysinfo/providers/windows/helpers_windows.go b/vendor/github.com/elastic/go-sysinfo/providers/windows/helpers_windows.go deleted file mode 100644 index 38940ff..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/windows/helpers_windows.go +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 windows - -import ( - "fmt" - - syswin "golang.org/x/sys/windows" -) - -// sidToString wraps the `String()` functions used to return SID strings in golang.org/x/sys -// These can return an error or no error, depending on the release. -func sidToString(strFunc *syswin.SID) (string, error) { - switch sig := (interface{})(strFunc).(type) { - case fmt.Stringer: - return sig.String(), nil - case errString: - return sig.String() - default: - return "", fmt.Errorf("missing or unexpected String() function signature for %#v", sig) - } -} - -type errString interface { - String() (string, error) -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/windows/host_windows.go b/vendor/github.com/elastic/go-sysinfo/providers/windows/host_windows.go deleted file mode 100644 index 96a90d9..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/windows/host_windows.go +++ /dev/null @@ -1,175 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 windows - -import ( - "errors" - "os" - "time" - - windows "github.com/elastic/go-windows" - "github.com/joeshaw/multierror" - - "github.com/elastic/go-sysinfo/internal/registry" - "github.com/elastic/go-sysinfo/providers/shared" - "github.com/elastic/go-sysinfo/types" -) - -func init() { - registry.Register(windowsSystem{}) -} - -type windowsSystem struct{} - -func (s windowsSystem) Host() (types.Host, error) { - return newHost() -} - -type host struct { - info types.HostInfo -} - -func (h *host) Info() types.HostInfo { - return h.info -} - -func (h *host) CPUTime() (types.CPUTimes, error) { - idle, kernel, user, err := windows.GetSystemTimes() - if err != nil { - return types.CPUTimes{}, err - } - - return types.CPUTimes{ - System: kernel, - User: user, - Idle: idle, - }, nil -} - -func (h *host) Memory() (*types.HostMemoryInfo, error) { - mem, err := windows.GlobalMemoryStatusEx() - if err != nil { - return nil, err - } - - return &types.HostMemoryInfo{ - Total: mem.TotalPhys, - Used: mem.TotalPhys - mem.AvailPhys, - Free: mem.AvailPhys, - Available: mem.AvailPhys, - VirtualTotal: mem.TotalPageFile, - VirtualUsed: mem.TotalPageFile - mem.AvailPageFile, - VirtualFree: mem.AvailPageFile, - }, nil -} - -func newHost() (*host, error) { - h := &host{} - r := &reader{} - r.architecture(h) - r.bootTime(h) - r.hostname(h) - r.network(h) - r.kernelVersion(h) - r.os(h) - r.time(h) - r.uniqueID(h) - return h, r.Err() -} - -type reader struct { - errs []error -} - -func (r *reader) addErr(err error) bool { - if err != nil { - if !errors.Is(err, types.ErrNotImplemented) { - r.errs = append(r.errs, err) - } - return true - } - return false -} - -func (r *reader) Err() error { - if len(r.errs) > 0 { - return &multierror.MultiError{Errors: r.errs} - } - return nil -} - -func (r *reader) architecture(h *host) { - v, err := Architecture() - if r.addErr(err) { - return - } - h.info.Architecture = v -} - -func (r *reader) bootTime(h *host) { - v, err := BootTime() - if r.addErr(err) { - return - } - h.info.BootTime = v -} - -func (r *reader) hostname(h *host) { - v, err := os.Hostname() - if r.addErr(err) { - return - } - h.info.Hostname = v -} - -func (r *reader) network(h *host) { - ips, macs, err := shared.Network() - if r.addErr(err) { - return - } - h.info.IPs = ips - h.info.MACs = macs -} - -func (r *reader) kernelVersion(h *host) { - v, err := KernelVersion() - if r.addErr(err) { - return - } - h.info.KernelVersion = v -} - -func (r *reader) os(h *host) { - v, err := OperatingSystem() - if r.addErr(err) { - return - } - h.info.OS = v -} - -func (r *reader) time(h *host) { - h.info.Timezone, h.info.TimezoneOffsetSec = time.Now().Zone() -} - -func (r *reader) uniqueID(h *host) { - v, err := MachineID() - if r.addErr(err) { - return - } - h.info.UniqueID = v -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/windows/kernel_windows.go b/vendor/github.com/elastic/go-sysinfo/providers/windows/kernel_windows.go deleted file mode 100644 index c295c79..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/windows/kernel_windows.go +++ /dev/null @@ -1,43 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 windows - -import ( - windows "github.com/elastic/go-windows" -) - -const windowsKernelExe = `C:\Windows\System32\ntoskrnl.exe` - -func KernelVersion() (string, error) { - versionData, err := windows.GetFileVersionInfo(windowsKernelExe) - if err != nil { - return "", err - } - - fileVersion, err := versionData.QueryValue("FileVersion") - if err == nil { - return fileVersion, nil - } - - // Make a second attempt through the fixed version info. - info, err := versionData.FixedFileInfo() - if err != nil { - return "", err - } - return info.ProductVersion(), nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/windows/machineid_windows.go b/vendor/github.com/elastic/go-sysinfo/providers/windows/machineid_windows.go deleted file mode 100644 index 0c69c89..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/windows/machineid_windows.go +++ /dev/null @@ -1,47 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 windows - -import ( - "fmt" - - "golang.org/x/sys/windows/registry" -) - -func MachineID() (string, error) { - return getMachineGUID() -} - -func getMachineGUID() (string, error) { - const key = registry.LOCAL_MACHINE - const path = `SOFTWARE\Microsoft\Cryptography` - const name = "MachineGuid" - - k, err := registry.OpenKey(key, path, registry.READ|registry.WOW64_64KEY) - if err != nil { - return "", fmt.Errorf(`failed to open HKLM\%v: %w`, path, err) - } - defer k.Close() - - guid, _, err := k.GetStringValue(name) - if err != nil { - return "", fmt.Errorf(`failed to get value of HKLM\%v\%v: %w`, path, name, err) - } - - return guid, nil -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/windows/os_windows.go b/vendor/github.com/elastic/go-sysinfo/providers/windows/os_windows.go deleted file mode 100644 index bc74a1e..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/windows/os_windows.go +++ /dev/null @@ -1,115 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 windows - -import ( - "fmt" - "strconv" - "strings" - - "golang.org/x/sys/windows/registry" - - "github.com/elastic/go-sysinfo/types" -) - -func OperatingSystem() (*types.OSInfo, error) { - const key = registry.LOCAL_MACHINE - const path = `SOFTWARE\Microsoft\Windows NT\CurrentVersion` - const flags = registry.READ | registry.WOW64_64KEY - - k, err := registry.OpenKey(key, path, flags) - if err != nil { - return nil, fmt.Errorf(`failed to open HKLM\%v: %w`, path, err) - } - defer k.Close() - - osInfo := &types.OSInfo{ - Type: "windows", - Family: "windows", - Platform: "windows", - } - name := "ProductName" - osInfo.Name, _, err = k.GetStringValue(name) - if err != nil { - return nil, fmt.Errorf(`failed to get value of HKLM\%v\%v: %w`, path, name, err) - } - - // Newer versions (Win 10 and 2016) have CurrentMajor/CurrentMinor. - major, _, majorErr := k.GetIntegerValue("CurrentMajorVersionNumber") - minor, _, minorErr := k.GetIntegerValue("CurrentMinorVersionNumber") - if majorErr == nil && minorErr == nil { - osInfo.Major = int(major) - osInfo.Minor = int(minor) - osInfo.Version = fmt.Sprintf("%d.%d", major, minor) - } else { - name = "CurrentVersion" - osInfo.Version, _, err = k.GetStringValue(name) - if err != nil { - return nil, fmt.Errorf(`failed to get value of HKLM\%v\%v: %w`, path, name, err) - } - parts := strings.SplitN(osInfo.Version, ".", 3) - for i, p := range parts { - switch i { - case 0: - osInfo.Major, _ = strconv.Atoi(p) - case 1: - osInfo.Major, _ = strconv.Atoi(p) - } - } - } - - name = "CurrentBuild" - currentBuild, _, err := k.GetStringValue(name) - if err != nil { - return nil, fmt.Errorf(`failed to get value of HKLM\%v\%v: %w`, path, name, err) - } - osInfo.Build = currentBuild - - // Update Build Revision (optional) - name = "UBR" - updateBuildRevision, _, err := k.GetIntegerValue(name) - if err != nil && err != registry.ErrNotExist { - return nil, fmt.Errorf(`failed to get value of HKLM\%v\%v: %w`, path, name, err) - } else { - osInfo.Build = fmt.Sprintf("%v.%d", osInfo.Build, updateBuildRevision) - } - - fixWindows11Naming(currentBuild, osInfo) - - return osInfo, nil -} - -// fixWindows11Naming adjusts the OS name because the ProductName registry value -// was not changed in Windows 11 and still contains Windows 10. If the product -// name contains "Windows 10" and the version is greater than or equal to -// 10.0.22000 then "Windows 10" is replaced with "Windows 11" in the OS name. -// -// https://docs.microsoft.com/en-us/answers/questions/586619/windows-11-build-ver-is-still-10022000194.html -func fixWindows11Naming(currentBuild string, osInfo *types.OSInfo) { - buildNumber, err := strconv.Atoi(currentBuild) - if err != nil { - return - } - - // "Anything above [or equal] 10.0.22000.0 is Win 11. Anything below is Win 10." - if osInfo.Major > 10 || - osInfo.Major == 10 && osInfo.Minor > 0 || - osInfo.Major == 10 && osInfo.Minor == 0 && buildNumber >= 22000 { - osInfo.Name = strings.Replace(osInfo.Name, "Windows 10", "Windows 11", 1) - } -} diff --git a/vendor/github.com/elastic/go-sysinfo/providers/windows/process_windows.go b/vendor/github.com/elastic/go-sysinfo/providers/windows/process_windows.go deleted file mode 100644 index 7086bce..0000000 --- a/vendor/github.com/elastic/go-sysinfo/providers/windows/process_windows.go +++ /dev/null @@ -1,383 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 windows - -import ( - "errors" - "fmt" - "os" - "path/filepath" - "strings" - "syscall" - "time" - "unsafe" - - syswin "golang.org/x/sys/windows" - - windows "github.com/elastic/go-windows" - - "github.com/elastic/go-sysinfo/types" -) - -var ( - selfPID = os.Getpid() - devMapper = newDeviceMapper() -) - -func (s windowsSystem) Processes() (procs []types.Process, err error) { - pids, err := windows.EnumProcesses() - if err != nil { - return nil, fmt.Errorf("EnumProcesses: %w", err) - } - procs = make([]types.Process, 0, len(pids)) - var proc types.Process - for _, pid := range pids { - if pid == 0 || pid == 4 { - // The Idle and System processes (PIDs 0 and 4) can never be - // opened by user-level code (see documentation for OpenProcess). - continue - } - - if proc, err = s.Process(int(pid)); err == nil { - procs = append(procs, proc) - } - } - if len(procs) == 0 { - return nil, err - } - return procs, nil -} - -func (s windowsSystem) Process(pid int) (types.Process, error) { - return newProcess(pid) -} - -func (s windowsSystem) Self() (types.Process, error) { - return newProcess(selfPID) -} - -type process struct { - pid int - info types.ProcessInfo -} - -func (p *process) PID() int { - return p.pid -} - -func (p *process) Parent() (types.Process, error) { - info, err := p.Info() - if err != nil { - return nil, err - } - - return newProcess(info.PPID) -} - -func newProcess(pid int) (*process, error) { - p := &process{pid: pid} - if err := p.init(); err != nil { - return nil, err - } - return p, nil -} - -func (p *process) init() error { - handle, err := p.open() - if err != nil { - return err - } - defer syscall.CloseHandle(handle) - - var path string - if imgf, err := windows.GetProcessImageFileName(handle); err == nil { - path, err = devMapper.DevicePathToDrivePath(imgf) - if err != nil { - path = imgf - } - } - - var creationTime, exitTime, kernelTime, userTime syscall.Filetime - if err := syscall.GetProcessTimes(handle, &creationTime, &exitTime, &kernelTime, &userTime); err != nil { - return err - } - - // Try to read the RTL_USER_PROCESS_PARAMETERS struct from the target process - // memory. This can fail due to missing access rights or when we are running - // as a 32bit process in a 64bit system (WOW64). - // Don't make this a fatal error: If it fails, `args` and `cwd` fields will - // be missing. - var args []string - var cwd string - var ppid int - pbi, err := getProcessBasicInformation(syswin.Handle(handle)) - if err == nil { - ppid = int(pbi.InheritedFromUniqueProcessID) - userProcParams, err := getUserProcessParams(syswin.Handle(handle), pbi) - if err == nil { - if argsW, err := readProcessUnicodeString(handle, &userProcParams.CommandLine); err == nil { - args, err = splitCommandline(argsW) - if err != nil { - args = nil - } - } - if cwdW, err := readProcessUnicodeString(handle, &userProcParams.CurrentDirectoryPath); err == nil { - cwd, _, err = windows.UTF16BytesToString(cwdW) - if err != nil { - cwd = "" - } - // Remove trailing separator - cwd = strings.TrimRight(cwd, "\\") - } - } - } - - p.info = types.ProcessInfo{ - Name: filepath.Base(path), - PID: p.pid, - PPID: ppid, - Exe: path, - Args: args, - CWD: cwd, - StartTime: time.Unix(0, creationTime.Nanoseconds()), - } - return nil -} - -func getProcessBasicInformation(handle syswin.Handle) (pbi windows.ProcessBasicInformationStruct, err error) { - var actualSize uint32 - err = syswin.NtQueryInformationProcess(handle, syswin.ProcessBasicInformation, unsafe.Pointer(&pbi), uint32(windows.SizeOfProcessBasicInformationStruct), &actualSize) - if actualSize < uint32(windows.SizeOfProcessBasicInformationStruct) { - return pbi, errors.New("bad size for PROCESS_BASIC_INFORMATION") - } - return pbi, err -} - -func getUserProcessParams(handle syswin.Handle, pbi windows.ProcessBasicInformationStruct) (params windows.RtlUserProcessParameters, err error) { - const is32bitProc = unsafe.Sizeof(uintptr(0)) == 4 - - // Offset of params field within PEB structure. - // This structure is different in 32 and 64 bit. - paramsOffset := 0x20 - if is32bitProc { - paramsOffset = 0x10 - } - - // Read the PEB from the target process memory - pebSize := paramsOffset + 8 - peb := make([]byte, pebSize) - var nRead uintptr - err = syswin.ReadProcessMemory(handle, pbi.PebBaseAddress, &peb[0], uintptr(pebSize), &nRead) - if err != nil { - return params, err - } - if nRead != uintptr(pebSize) { - return params, fmt.Errorf("PEB: short read (%d/%d)", nRead, pebSize) - } - - // Get the RTL_USER_PROCESS_PARAMETERS struct pointer from the PEB - paramsAddr := *(*uintptr)(unsafe.Pointer(&peb[paramsOffset])) - - // Read the RTL_USER_PROCESS_PARAMETERS from the target process memory - paramsBuf := make([]byte, windows.SizeOfRtlUserProcessParameters) - err = syswin.ReadProcessMemory(handle, paramsAddr, ¶msBuf[0], uintptr(windows.SizeOfRtlUserProcessParameters), &nRead) - if err != nil { - return params, err - } - if nRead != uintptr(windows.SizeOfRtlUserProcessParameters) { - return params, fmt.Errorf("RTL_USER_PROCESS_PARAMETERS: short read (%d/%d)", nRead, windows.SizeOfRtlUserProcessParameters) - } - - params = *(*windows.RtlUserProcessParameters)(unsafe.Pointer(¶msBuf[0])) - return params, nil -} - -// read an UTF-16 string from another process memory. Result is an []byte -// with the UTF-16 data. -func readProcessUnicodeString(handle syscall.Handle, s *windows.UnicodeString) ([]byte, error) { - // Allocate an extra UTF-16 null character at the end in case the read string - // is not terminated. - extra := 2 - if s.Size&1 != 0 { - extra = 3 // If size is odd, need 3 nulls to terminate. - } - buf := make([]byte, int(s.Size)+extra) - nRead, err := windows.ReadProcessMemory(handle, s.Buffer, buf[:s.Size]) - if err != nil { - return nil, err - } - if nRead != uintptr(s.Size) { - return nil, fmt.Errorf("unicode string: short read: (%d/%d)", nRead, s.Size) - } - return buf, nil -} - -// Use Windows' CommandLineToArgv API to split an UTF-16 command line string -// into a list of parameters. -func splitCommandline(utf16 []byte) ([]string, error) { - n := len(utf16) - // Discard odd byte - if n&1 != 0 { - n-- - utf16 = utf16[:n] - } - if n == 0 { - return nil, nil - } - terminated := false - for i := 0; i < n && !terminated; i += 2 { - terminated = utf16[i] == 0 && utf16[i+1] == 0 - } - if !terminated { - // Append a null uint16 at the end if terminator is missing - utf16 = append(utf16, 0, 0) - } - var numArgs int32 - argsWide, err := syscall.CommandLineToArgv((*uint16)(unsafe.Pointer(&utf16[0])), &numArgs) - if err != nil { - return nil, err - } - - // Free memory allocated for CommandLineToArgvW arguments. - defer syscall.LocalFree((syscall.Handle)(unsafe.Pointer(argsWide))) - - args := make([]string, numArgs) - for idx := range args { - args[idx] = syscall.UTF16ToString(argsWide[idx][:]) - } - return args, nil -} - -func (p *process) open() (handle syscall.Handle, err error) { - if p.pid == selfPID { - return syscall.GetCurrentProcess() - } - - // Try different access rights, from broader to more limited. - // PROCESS_VM_READ is needed to get command-line and working directory - // PROCESS_QUERY_LIMITED_INFORMATION is only available in Vista+ - for _, permissions := range [4]uint32{ - syscall.PROCESS_QUERY_INFORMATION | windows.PROCESS_VM_READ, - windows.PROCESS_QUERY_LIMITED_INFORMATION | windows.PROCESS_VM_READ, - syscall.PROCESS_QUERY_INFORMATION, - windows.PROCESS_QUERY_LIMITED_INFORMATION, - } { - if handle, err = syscall.OpenProcess(permissions, false, uint32(p.pid)); err == nil { - break - } - } - return handle, err -} - -func (p *process) Info() (types.ProcessInfo, error) { - return p.info, nil -} - -func (p *process) User() (types.UserInfo, error) { - handle, err := p.open() - if err != nil { - return types.UserInfo{}, fmt.Errorf("OpenProcess failed: %w", err) - } - defer syscall.CloseHandle(handle) - - var accessToken syswin.Token - err = syswin.OpenProcessToken(syswin.Handle(handle), syscall.TOKEN_QUERY, &accessToken) - if err != nil { - return types.UserInfo{}, fmt.Errorf("OpenProcessToken failed: %w", err) - } - defer accessToken.Close() - - tokenUser, err := accessToken.GetTokenUser() - if err != nil { - return types.UserInfo{}, fmt.Errorf("GetTokenUser failed: %w", err) - } - - sid, err := sidToString(tokenUser.User.Sid) - if sid == "" || err != nil { - if err != nil { - return types.UserInfo{}, fmt.Errorf("failed to look up user SID: %w", err) - } - return types.UserInfo{}, errors.New("failed to look up user SID") - } - - tokenGroup, err := accessToken.GetTokenPrimaryGroup() - if err != nil { - return types.UserInfo{}, fmt.Errorf("GetTokenPrimaryGroup failed: %w", err) - } - - gsid, err := sidToString(tokenGroup.PrimaryGroup) - if gsid == "" || err != nil { - if err != nil { - return types.UserInfo{}, fmt.Errorf("failed to look up primary group SID: %w", err) - } - return types.UserInfo{}, errors.New("failed to look up primary group SID") - } - - return types.UserInfo{ - UID: sid, - GID: gsid, - }, nil -} - -func (p *process) Memory() (types.MemoryInfo, error) { - handle, err := p.open() - if err != nil { - return types.MemoryInfo{}, err - } - defer syscall.CloseHandle(handle) - - counters, err := windows.GetProcessMemoryInfo(handle) - if err != nil { - return types.MemoryInfo{}, err - } - - return types.MemoryInfo{ - Resident: uint64(counters.WorkingSetSize), - Virtual: uint64(counters.PrivateUsage), - }, nil -} - -func (p *process) CPUTime() (types.CPUTimes, error) { - handle, err := p.open() - if err != nil { - return types.CPUTimes{}, err - } - defer syscall.CloseHandle(handle) - - var creationTime, exitTime, kernelTime, userTime syscall.Filetime - if err := syscall.GetProcessTimes(handle, &creationTime, &exitTime, &kernelTime, &userTime); err != nil { - return types.CPUTimes{}, err - } - - return types.CPUTimes{ - User: windows.FiletimeToDuration(&userTime), - System: windows.FiletimeToDuration(&kernelTime), - }, nil -} - -// OpenHandles returns the number of open handles of the process. -func (p *process) OpenHandleCount() (int, error) { - handle, err := p.open() - if err != nil { - return 0, err - } - defer syscall.CloseHandle(handle) - - count, err := windows.GetProcessHandleCount(handle) - return int(count), err -} diff --git a/vendor/github.com/elastic/go-sysinfo/system.go b/vendor/github.com/elastic/go-sysinfo/system.go deleted file mode 100644 index b9a3360..0000000 --- a/vendor/github.com/elastic/go-sysinfo/system.go +++ /dev/null @@ -1,87 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 sysinfo - -import ( - "runtime" - - "github.com/elastic/go-sysinfo/internal/registry" - "github.com/elastic/go-sysinfo/types" - - // Register host and process providers. - _ "github.com/elastic/go-sysinfo/providers/aix" - _ "github.com/elastic/go-sysinfo/providers/darwin" - _ "github.com/elastic/go-sysinfo/providers/linux" - _ "github.com/elastic/go-sysinfo/providers/windows" -) - -// Go returns information about the Go runtime. -func Go() types.GoInfo { - return types.GoInfo{ - OS: runtime.GOOS, - Arch: runtime.GOARCH, - MaxProcs: runtime.GOMAXPROCS(0), - Version: runtime.Version(), - } -} - -// Host returns information about host on which this process is running. If -// host information collection is not implemented for this platform then -// types.ErrNotImplemented is returned. -// On Darwin (macOS) a types.ErrNotImplemented is returned with cgo disabled. -func Host() (types.Host, error) { - provider := registry.GetHostProvider() - if provider == nil { - return nil, types.ErrNotImplemented - } - return provider.Host() -} - -// Process returns a types.Process object representing the process associated -// with the given PID. The types.Process object can be used to query information -// about the process. If process information collection is not implemented for -// this platform then types.ErrNotImplemented is returned. -func Process(pid int) (types.Process, error) { - provider := registry.GetProcessProvider() - if provider == nil { - return nil, types.ErrNotImplemented - } - return provider.Process(pid) -} - -// Processes return a list of all processes. If process information collection -// is not implemented for this platform then types.ErrNotImplemented is -// returned. -func Processes() ([]types.Process, error) { - provider := registry.GetProcessProvider() - if provider == nil { - return nil, types.ErrNotImplemented - } - return provider.Processes() -} - -// Self return a types.Process object representing this process. If process -// information collection is not implemented for this platform then -// types.ErrNotImplemented is returned. -func Self() (types.Process, error) { - provider := registry.GetProcessProvider() - if provider == nil { - return nil, types.ErrNotImplemented - } - return provider.Self() -} diff --git a/vendor/github.com/elastic/go-sysinfo/types/errors.go b/vendor/github.com/elastic/go-sysinfo/types/errors.go deleted file mode 100644 index 7e509bc..0000000 --- a/vendor/github.com/elastic/go-sysinfo/types/errors.go +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 types - -import "errors" - -// ErrNotImplemented represents an error for a function that is not implemented on a particular platform. -var ErrNotImplemented = errors.New("unimplemented") diff --git a/vendor/github.com/elastic/go-sysinfo/types/go.go b/vendor/github.com/elastic/go-sysinfo/types/go.go deleted file mode 100644 index 6237744..0000000 --- a/vendor/github.com/elastic/go-sysinfo/types/go.go +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 types - -// GoInfo contains info about the go runtime -type GoInfo struct { - OS string `json:"os"` - Arch string `json:"arch"` - MaxProcs int `json:"max_procs"` - Version string `json:"version"` -} diff --git a/vendor/github.com/elastic/go-sysinfo/types/host.go b/vendor/github.com/elastic/go-sysinfo/types/host.go deleted file mode 100644 index d2911ee..0000000 --- a/vendor/github.com/elastic/go-sysinfo/types/host.go +++ /dev/null @@ -1,299 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 types - -import "time" - -// Host is the interface that wraps methods for returning Host stats -// It may return partial information if the provider -// implementation is unable to collect all of the necessary data. -type Host interface { - CPUTimer - Info() HostInfo - Memory() (*HostMemoryInfo, error) -} - -// NetworkCounters represents network stats from /proc/net -type NetworkCounters interface { - NetworkCounters() (*NetworkCountersInfo, error) -} - -// SNMP represents the data from /proc/net/snmp -// Note that according to RFC 2012,TCP.MaxConn, if present, is a signed value and should be cast to int64 -type SNMP struct { - IP map[string]uint64 `json:"ip" netstat:"Ip"` - ICMP map[string]uint64 `json:"icmp" netstat:"Icmp"` - ICMPMsg map[string]uint64 `json:"icmp_msg" netstat:"IcmpMsg"` - TCP map[string]uint64 `json:"tcp" netstat:"Tcp"` - UDP map[string]uint64 `json:"udp" netstat:"Udp"` - UDPLite map[string]uint64 `json:"udp_lite" netstat:"UdpLite"` -} - -// Netstat represents the data from /proc/net/netstat -type Netstat struct { - TCPExt map[string]uint64 `json:"tcp_ext" netstat:"TcpExt"` - IPExt map[string]uint64 `json:"ip_ext" netstat:"IpExt"` -} - -// NetworkCountersInfo represents available network counters from /proc/net -type NetworkCountersInfo struct { - SNMP SNMP `json:"snmp"` - Netstat Netstat `json:"netstat"` -} - -// VMStat is the interface wrapper for platforms that support /proc/vmstat. -type VMStat interface { - VMStat() (*VMStatInfo, error) -} - -// HostInfo contains basic host information. -type HostInfo struct { - Architecture string `json:"architecture"` // Hardware architecture (e.g. x86_64, arm, ppc, mips). - BootTime time.Time `json:"boot_time"` // Host boot time. - Containerized *bool `json:"containerized,omitempty"` // Is the process containerized. - Hostname string `json:"name"` // Hostname - IPs []string `json:"ip,omitempty"` // List of all IPs. - KernelVersion string `json:"kernel_version"` // Kernel version. - MACs []string `json:"mac"` // List of MAC addresses. - OS *OSInfo `json:"os"` // OS information. - Timezone string `json:"timezone"` // System timezone. - TimezoneOffsetSec int `json:"timezone_offset_sec"` // Timezone offset (seconds from UTC). - UniqueID string `json:"id,omitempty"` // Unique ID of the host (optional). -} - -// Uptime returns the system uptime -func (host HostInfo) Uptime() time.Duration { - return time.Since(host.BootTime) -} - -// OSInfo contains basic OS information -type OSInfo struct { - Type string `json:"type"` // OS Type (one of linux, macos, unix, windows). - Family string `json:"family"` // OS Family (e.g. redhat, debian, freebsd, windows). - Platform string `json:"platform"` // OS platform (e.g. centos, ubuntu, windows). - Name string `json:"name"` // OS Name (e.g. Mac OS X, CentOS). - Version string `json:"version"` // OS version (e.g. 10.12.6). - Major int `json:"major"` // Major release version. - Minor int `json:"minor"` // Minor release version. - Patch int `json:"patch"` // Patch release version. - Build string `json:"build,omitempty"` // Build (e.g. 16G1114). - Codename string `json:"codename,omitempty"` // OS codename (e.g. jessie). -} - -// LoadAverage is the interface that wraps the LoadAverage method. -// LoadAverage returns load info on the host -type LoadAverage interface { - LoadAverage() (*LoadAverageInfo, error) -} - -// LoadAverageInfo contains load statistics -type LoadAverageInfo struct { - One float64 `json:"one_min"` - Five float64 `json:"five_min"` - Fifteen float64 `json:"fifteen_min"` -} - -// HostMemoryInfo (all values are specified in bytes). -type HostMemoryInfo struct { - Total uint64 `json:"total_bytes"` // Total physical memory. - Used uint64 `json:"used_bytes"` // Total - Free - Available uint64 `json:"available_bytes"` // Amount of memory available without swapping. - Free uint64 `json:"free_bytes"` // Amount of memory not used by the system. - VirtualTotal uint64 `json:"virtual_total_bytes"` // Total virtual memory. - VirtualUsed uint64 `json:"virtual_used_bytes"` // VirtualTotal - VirtualFree - VirtualFree uint64 `json:"virtual_free_bytes"` // Virtual memory that is not used. - Metrics map[string]uint64 `json:"raw,omitempty"` // Other memory related metrics. -} - -// VMStatInfo contains parsed info from /proc/vmstat. -// This procfs file has expanded much over the years -// with different kernel versions. If we don't have a field in vmstat, -// the field in the struct will just be blank. The comments represent kernel versions. -type VMStatInfo struct { - NrFreePages uint64 `json:"nr_free_pages"` // (since Linux 2.6.31) - NrAllocBatch uint64 `json:"nr_alloc_batch"` // (since Linux 3.12) - NrInactiveAnon uint64 `json:"nr_inactive_anon"` // (since Linux 2.6.28) - NrActiveAnon uint64 `json:"nr_active_anon"` // (since Linux 2.6.28) - NrInactiveFile uint64 `json:"nr_inactive_file"` // (since Linux 2.6.28) - NrActiveFile uint64 `json:"nr_active_file"` // (since Linux 2.6.28) - NrUnevictable uint64 `json:"nr_unevictable"` // (since Linux 2.6.28) - NrMlock uint64 `json:"nr_mlock"` // (since Linux 2.6.28) - NrAnonPages uint64 `json:"nr_anon_pages"` // (since Linux 2.6.18) - NrMapped uint64 `json:"nr_mapped"` // (since Linux 2.6.0) - NrFilePages uint64 `json:"nr_file_pages"` // (since Linux 2.6.18) - NrDirty uint64 `json:"nr_dirty"` // (since Linux 2.6.0) - NrWriteback uint64 `json:"nr_writeback"` // (since Linux 2.6.0) - NrSlabReclaimable uint64 `json:"nr_slab_reclaimable"` // (since Linux 2.6.19) - NrSlabUnreclaimable uint64 `json:"nr_slab_unreclaimable"` // (since Linux 2.6.19) - NrPageTablePages uint64 `json:"nr_page_table_pages"` // (since Linux 2.6.0) - NrKernelStack uint64 `json:"nr_kernel_stack"` // (since Linux 2.6.32) Amount of memory allocated to kernel stacks. - NrUnstable uint64 `json:"nr_unstable"` // (since Linux 2.6.0) - NrBounce uint64 `json:"nr_bounce"` // (since Linux 2.6.12) - NrVmscanWrite uint64 `json:"nr_vmscan_write"` // (since Linux 2.6.19) - NrVmscanImmediateReclaim uint64 `json:"nr_vmscan_immediate_reclaim"` // (since Linux 3.2) - NrWritebackTemp uint64 `json:"nr_writeback_temp"` // (since Linux 2.6.26) - NrIsolatedAnon uint64 `json:"nr_isolated_anon"` // (since Linux 2.6.32) - NrIsolatedFile uint64 `json:"nr_isolated_file"` // (since Linux 2.6.32) - NrShmem uint64 `json:"nr_shmem"` // (since Linux 2.6.32) Pages used by shmem and tmpfs(5). - NrDirtied uint64 `json:"nr_dirtied"` // (since Linux 2.6.37) - NrWritten uint64 `json:"nr_written"` // (since Linux 2.6.37) - NrPagesScanned uint64 `json:"nr_pages_scanned"` // (since Linux 3.17) - NumaHit uint64 `json:"numa_hit"` // (since Linux 2.6.18) - NumaMiss uint64 `json:"numa_miss"` // (since Linux 2.6.18) - NumaForeign uint64 `json:"numa_foreign"` // (since Linux 2.6.18) - NumaInterleave uint64 `json:"numa_interleave"` // (since Linux 2.6.18) - NumaLocal uint64 `json:"numa_local"` // (since Linux 2.6.18) - NumaOther uint64 `json:"numa_other"` // (since Linux 2.6.18) - WorkingsetRefault uint64 `json:"workingset_refault"` // (since Linux 3.15) - WorkingsetActivate uint64 `json:"workingset_activate"` // (since Linux 3.15) - WorkingsetNodereclaim uint64 `json:"workingset_nodereclaim"` // (since Linux 3.15) - NrAnonTransparentHugepages uint64 `json:"nr_anon_transparent_hugepages"` // (since Linux 2.6.38) - NrFreeCma uint64 `json:"nr_free_cma"` // (since Linux 3.7) Number of free CMA (Contiguous Memory Allocator) pages. - NrDirtyThreshold uint64 `json:"nr_dirty_threshold"` // (since Linux 2.6.37) - NrDirtyBackgroundThreshold uint64 `json:"nr_dirty_background_threshold"` // (since Linux 2.6.37) - Pgpgin uint64 `json:"pgpgin"` // (since Linux 2.6.0) - Pgpgout uint64 `json:"pgpgout"` // (since Linux 2.6.0) - Pswpin uint64 `json:"pswpin"` // (since Linux 2.6.0) - Pswpout uint64 `json:"pswpout"` // (since Linux 2.6.0) - PgallocDma uint64 `json:"pgalloc_dma"` // (since Linux 2.6.5) - PgallocDma32 uint64 `json:"pgalloc_dma32"` // (since Linux 2.6.16) - PgallocNormal uint64 `json:"pgalloc_normal"` // (since Linux 2.6.5) - PgallocHigh uint64 `json:"pgalloc_high"` // (since Linux 2.6.5) - PgallocMovable uint64 `json:"pgalloc_movable"` // (since Linux 2.6.23) - Pgfree uint64 `json:"pgfree"` // (since Linux 2.6.0) - Pgactivate uint64 `json:"pgactivate"` // (since Linux 2.6.0) - Pgdeactivate uint64 `json:"pgdeactivate"` // (since Linux 2.6.0) - Pgfault uint64 `json:"pgfault"` // (since Linux 2.6.0) - Pgmajfault uint64 `json:"pgmajfault"` // (since Linux 2.6.0) - PgrefillDma uint64 `json:"pgrefill_dma"` // (since Linux 2.6.5) - PgrefillDma32 uint64 `json:"pgrefill_dma32"` // (since Linux 2.6.16) - PgrefillNormal uint64 `json:"pgrefill_normal"` // (since Linux 2.6.5) - PgrefillHigh uint64 `json:"pgrefill_high"` // (since Linux 2.6.5) - PgrefillMovable uint64 `json:"pgrefill_movable"` // (since Linux 2.6.23) - PgstealKswapdDma uint64 `json:"pgsteal_kswapd_dma"` // (since Linux 3.4) - PgstealKswapdDma32 uint64 `json:"pgsteal_kswapd_dma32"` // (since Linux 3.4) - PgstealKswapdNormal uint64 `json:"pgsteal_kswapd_normal"` // (since Linux 3.4) - PgstealKswapdHigh uint64 `json:"pgsteal_kswapd_high"` // (since Linux 3.4) - PgstealKswapdMovable uint64 `json:"pgsteal_kswapd_movable"` // (since Linux 3.4) - PgstealDirectDma uint64 `json:"pgsteal_direct_dma"` - PgstealDirectDma32 uint64 `json:"pgsteal_direct_dma32"` // (since Linux 3.4) - PgstealDirectNormal uint64 `json:"pgsteal_direct_normal"` // (since Linux 3.4) - PgstealDirectHigh uint64 `json:"pgsteal_direct_high"` // (since Linux 3.4) - PgstealDirectMovable uint64 `json:"pgsteal_direct_movable"` // (since Linux 2.6.23) - PgscanKswapdDma uint64 `json:"pgscan_kswapd_dma"` - PgscanKswapdDma32 uint64 `json:"pgscan_kswapd_dma32"` // (since Linux 2.6.16) - PgscanKswapdNormal uint64 `json:"pgscan_kswapd_normal"` // (since Linux 2.6.5) - PgscanKswapdHigh uint64 `json:"pgscan_kswapd_high"` - PgscanKswapdMovable uint64 `json:"pgscan_kswapd_movable"` // (since Linux 2.6.23) - PgscanDirectDma uint64 `json:"pgscan_direct_dma"` // - PgscanDirectDma32 uint64 `json:"pgscan_direct_dma32"` // (since Linux 2.6.16) - PgscanDirectNormal uint64 `json:"pgscan_direct_normal"` - PgscanDirectHigh uint64 `json:"pgscan_direct_high"` - PgscanDirectMovable uint64 `json:"pgscan_direct_movable"` // (since Linux 2.6.23) - PgscanDirectThrottle uint64 `json:"pgscan_direct_throttle"` // (since Linux 3.6) - ZoneReclaimFailed uint64 `json:"zone_reclaim_failed"` // (since linux 2.6.31) - Pginodesteal uint64 `json:"pginodesteal"` // (since linux 2.6.0) - SlabsScanned uint64 `json:"slabs_scanned"` // (since linux 2.6.5) - KswapdInodesteal uint64 `json:"kswapd_inodesteal"` // (since linux 2.6.0) - KswapdLowWmarkHitQuickly uint64 `json:"kswapd_low_wmark_hit_quickly"` // (since 2.6.33) - KswapdHighWmarkHitQuickly uint64 `json:"kswapd_high_wmark_hit_quickly"` // (since 2.6.33) - Pageoutrun uint64 `json:"pageoutrun"` // (since Linux 2.6.0) - Allocstall uint64 `json:"allocstall"` // (since Linux 2.6.0) - Pgrotated uint64 `json:"pgrotated"` // (since Linux 2.6.0) - DropPagecache uint64 `json:"drop_pagecache"` // (since Linux 3.15) - DropSlab uint64 `json:"drop_slab"` // (since Linux 3.15) - NumaPteUpdates uint64 `json:"numa_pte_updates"` // (since Linux 3.8) - NumaHugePteUpdates uint64 `json:"numa_huge_pte_updates"` // (since Linux 3.13) - NumaHintFaults uint64 `json:"numa_hint_faults"` // (since Linux 3.8) - NumaHintFaultsLocal uint64 `json:"numa_hint_faults_local"` // (since Linux 3.8) - NumaPagesMigrated uint64 `json:"numa_pages_migrated"` // (since Linux 3.8) - PgmigrateSuccess uint64 `json:"pgmigrate_success"` // (since Linux 3.8) - PgmigrateFail uint64 `json:"pgmigrate_fail"` // (since Linux 3.8) - CompactMigrateScanned uint64 `json:"compact_migrate_scanned"` // (since Linux 3.8) - CompactFreeScanned uint64 `json:"compact_free_scanned"` // (since Linux 3.8) - CompactIsolated uint64 `json:"compact_isolated"` // (since Linux 3.8) - CompactStall uint64 `json:"compact_stall"` // (since Linux 2.6.35) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. - CompactFail uint64 `json:"compact_fail"` // (since Linux 2.6.35) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. - CompactSuccess uint64 `json:"compact_success"` // (since Linux 2.6.35) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. - HtlbBuddyAllocSuccess uint64 `json:"htlb_buddy_alloc_success"` // (since Linux 2.6.26) - HtlbBuddyAllocFail uint64 `json:"htlb_buddy_alloc_fail"` // (since Linux 2.6.26) - UnevictablePgsCulled uint64 `json:"unevictable_pgs_culled"` // (since Linux 2.6.28) - UnevictablePgsScanned uint64 `json:"unevictable_pgs_scanned"` // (since Linux 2.6.28) - UnevictablePgsRescued uint64 `json:"unevictable_pgs_rescued"` // (since Linux 2.6.28) - UnevictablePgsMlocked uint64 `json:"unevictable_pgs_mlocked"` // (since Linux 2.6.28) - UnevictablePgsMunlocked uint64 `json:"unevictable_pgs_munlocked"` // (since Linux 2.6.28) - UnevictablePgsCleared uint64 `json:"unevictable_pgs_cleared"` // (since Linux 2.6.28) - UnevictablePgsStranded uint64 `json:"unevictable_pgs_stranded"` // (since Linux 2.6.28) - ThpFaultAlloc uint64 `json:"thp_fault_alloc"` // (since Linux 2.6.39) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. - ThpFaultFallback uint64 `json:"thp_fault_fallback"` // (since Linux 2.6.39) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. - ThpCollapseAlloc uint64 `json:"thp_collapse_alloc"` // (since Linux 2.6.39) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. - ThpCollapseAllocFailed uint64 `json:"thp_collapse_alloc_failed"` // (since Linux 2.6.39) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. - ThpSplit uint64 `json:"thp_split"` // (since Linux 2.6.39) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. - ThpZeroPageAlloc uint64 `json:"thp_zero_page_alloc"` // (since Linux 3.8) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. - ThpZeroPageAllocFailed uint64 `json:"thp_zero_page_alloc_failed"` // (since Linux 3.8) See the kernel source file Documentation/admin-guide/mm/transhuge.rst. - BalloonInflate uint64 `json:"balloon_inflate"` // (since Linux 3.18) - BalloonDeflate uint64 `json:"balloon_deflate"` // (since Linux 3.18) - BalloonMigrate uint64 `json:"balloon_migrate"` // (since Linux 3.18) - NrTlbRemoteFlush uint64 `json:"nr_tlb_remote_flush"` // (since Linux 3.12) - NrTlbRemoteFlushReceived uint64 `json:"nr_tlb_remote_flush_received"` // (since Linux 3.12) - NrTlbLocalFlushAll uint64 `json:"nr_tlb_local_flush_all"` // (since Linux 3.12) - NrTlbLocalFlushOne uint64 `json:"nr_tlb_local_flush_one"` // (since Linux 3.12) - VmacacheFindCalls uint64 `json:"vmacache_find_calls"` // (since Linux 3.16) - VmacacheFindHits uint64 `json:"vmacache_find_hits"` // (since Linux 3.16) - VmacacheFullFlushes uint64 `json:"vmacache_full_flushes"` // (since Linux 3.19) - // the following fields are not documented in `man 5 proc` as of 4.15 - NrZoneInactiveAnon uint64 `json:"nr_zone_inactive_anon"` - NrZoneActiveAnon uint64 `json:"nr_zone_active_anon"` - NrZoneInactiveFile uint64 `json:"nr_zone_inactive_file"` - NrZoneActiveFile uint64 `json:"nr_zone_active_file"` - NrZoneUnevictable uint64 `json:"nr_zone_unevictable"` - NrZoneWritePending uint64 `json:"nr_zone_write_pending"` - NrZspages uint64 `json:"nr_zspages"` - NrShmemHugepages uint64 `json:"nr_shmem_hugepages"` - NrShmemPmdmapped uint64 `json:"nr_shmem_pmdmapped"` - AllocstallDma uint64 `json:"allocstall_dma"` - AllocstallDma32 uint64 `json:"allocstall_dma32"` - AllocstallNormal uint64 `json:"allocstall_normal"` - AllocstallMovable uint64 `json:"allocstall_movable"` - PgskipDma uint64 `json:"pgskip_dma"` - PgskipDma32 uint64 `json:"pgskip_dma32"` - PgskipNormal uint64 `json:"pgskip_normal"` - PgskipMovable uint64 `json:"pgskip_movable"` - Pglazyfree uint64 `json:"pglazyfree"` - Pglazyfreed uint64 `json:"pglazyfreed"` - Pgrefill uint64 `json:"pgrefill"` - PgstealKswapd uint64 `json:"pgsteal_kswapd"` - PgstealDirect uint64 `json:"pgsteal_direct"` - PgscanKswapd uint64 `json:"pgscan_kswapd"` - PgscanDirect uint64 `json:"pgscan_direct"` - OomKill uint64 `json:"oom_kill"` - CompactDaemonWake uint64 `json:"compact_daemon_wake"` - CompactDaemonMigrateScanned uint64 `json:"compact_daemon_migrate_scanned"` - CompactDaemonFreeScanned uint64 `json:"compact_daemon_free_scanned"` - ThpFileAlloc uint64 `json:"thp_file_alloc"` - ThpFileMapped uint64 `json:"thp_file_mapped"` - ThpSplitPage uint64 `json:"thp_split_page"` - ThpSplitPageFailed uint64 `json:"thp_split_page_failed"` - ThpDeferredSplitPage uint64 `json:"thp_deferred_split_page"` - ThpSplitPmd uint64 `json:"thp_split_pmd"` - ThpSplitPud uint64 `json:"thp_split_pud"` - ThpSwpout uint64 `json:"thp_swpout"` - ThpSwpoutFallback uint64 `json:"thp_swpout_fallback"` - SwapRa uint64 `json:"swap_ra"` - SwapRaHit uint64 `json:"swap_ra_hit"` -} diff --git a/vendor/github.com/elastic/go-sysinfo/types/process.go b/vendor/github.com/elastic/go-sysinfo/types/process.go deleted file mode 100644 index 74a396e..0000000 --- a/vendor/github.com/elastic/go-sysinfo/types/process.go +++ /dev/null @@ -1,160 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. 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 types - -import "time" - -// Process is the main wrapper for gathering information on a process -type Process interface { - CPUTimer - // Info returns process info. - // It may return partial information if the provider - // implementation is unable to collect all of the necessary data. - Info() (ProcessInfo, error) - Memory() (MemoryInfo, error) - User() (UserInfo, error) - Parent() (Process, error) - PID() int -} - -// ProcessInfo contains basic stats about a process -type ProcessInfo struct { - Name string `json:"name"` - PID int `json:"pid"` - PPID int `json:"ppid"` - CWD string `json:"cwd"` - Exe string `json:"exe"` - Args []string `json:"args"` - StartTime time.Time `json:"start_time"` -} - -// UserInfo contains information about the UID and GID -// values of a process. -type UserInfo struct { - // UID is the user ID. - // On Linux and Darwin (macOS) this is the real user ID. - // On Windows, this is the security identifier (SID) of the - // user account of the process access token. - UID string `json:"uid"` - - // On Linux and Darwin (macOS) this is the effective user ID. - // On Windows, this is empty. - EUID string `json:"euid"` - - // On Linux and Darwin (macOS) this is the saved user ID. - // On Windows, this is empty. - SUID string `json:"suid"` - - // GID is the primary group ID. - // On Linux and Darwin (macOS) this is the real group ID. - // On Windows, this is the security identifier (SID) of the - // primary group of the process access token. - GID string `json:"gid"` - - // On Linux and Darwin (macOS) this is the effective group ID. - // On Windows, this is empty. - EGID string `json:"egid"` - - // On Linux and Darwin (macOS) this is the saved group ID. - // On Windows, this is empty. - SGID string `json:"sgid"` -} - -// Environment is the interface that wraps the Environment method. -// Environment returns variables for a process -type Environment interface { - Environment() (map[string]string, error) -} - -// OpenHandleEnumerator is the interface that wraps the OpenHandles method. -// OpenHandles lists the open file handles. -type OpenHandleEnumerator interface { - OpenHandles() ([]string, error) -} - -// OpenHandleCounter is the interface that wraps the OpenHandleCount method. -// OpenHandleCount returns the number of open file handles. -type OpenHandleCounter interface { - OpenHandleCount() (int, error) -} - -// CPUTimer is the interface that wraps the CPUTime method. -// CPUTime returns CPU time info -type CPUTimer interface { - // CPUTime returns a CPUTimes structure for - // the host or some process. - // - // The User and System fields are guaranteed - // to be populated for all platforms, and - // for both hosts and processes. - // This may return types.ErrNotImplemented - // if the provider cannot implement collection of this data. - CPUTime() (CPUTimes, error) -} - -// CPUTimes contains CPU timing stats for a process -type CPUTimes struct { - User time.Duration `json:"user"` - System time.Duration `json:"system"` - Idle time.Duration `json:"idle,omitempty"` - IOWait time.Duration `json:"iowait,omitempty"` - IRQ time.Duration `json:"irq,omitempty"` - Nice time.Duration `json:"nice,omitempty"` - SoftIRQ time.Duration `json:"soft_irq,omitempty"` - Steal time.Duration `json:"steal,omitempty"` -} - -// Total returns the total CPU time -func (cpu CPUTimes) Total() time.Duration { - return cpu.User + cpu.System + cpu.Idle + cpu.IOWait + cpu.IRQ + cpu.Nice + - cpu.SoftIRQ + cpu.Steal -} - -// MemoryInfo contains memory stats for a process -type MemoryInfo struct { - Resident uint64 `json:"resident_bytes"` - Virtual uint64 `json:"virtual_bytes"` - Metrics map[string]uint64 `json:"raw,omitempty"` // Other memory related metrics. -} - -// SeccompInfo contains seccomp info for a process -type SeccompInfo struct { - Mode string `json:"mode"` - NoNewPrivs *bool `json:"no_new_privs,omitempty"` // Added in kernel 4.10. -} - -// CapabilityInfo contains capability set info. -type CapabilityInfo struct { - Inheritable []string `json:"inheritable"` - Permitted []string `json:"permitted"` - Effective []string `json:"effective"` - Bounding []string `json:"bounding"` - Ambient []string `json:"ambient"` -} - -// Capabilities is the interface that wraps the Capabilities method. -// Capabilities returns capabilities for a process -type Capabilities interface { - Capabilities() (*CapabilityInfo, error) -} - -// Seccomp is the interface that wraps the Seccomp method. -// Seccomp returns seccomp info on Linux -type Seccomp interface { - Seccomp() (*SeccompInfo, error) -} diff --git a/vendor/github.com/elastic/go-windows/.appveyor.yml b/vendor/github.com/elastic/go-windows/.appveyor.yml deleted file mode 100644 index ab06a51..0000000 --- a/vendor/github.com/elastic/go-windows/.appveyor.yml +++ /dev/null @@ -1,61 +0,0 @@ -# Version format -version: "{build}" - -image: Visual Studio 2015 - -# Environment variables -environment: - GOPATH: c:\gopath - GO111MODULE: on - GVM_GO_VERSION: 1.12.4 - GVM_DL: https://github.com/andrewkroh/gvm/releases/download/v0.2.0/gvm-windows-amd64.exe - -# Custom clone folder (variables are not expanded here). -clone_folder: c:\gopath\src\github.com\elastic\go-windows - -# Cache mingw install until appveyor.yml is modified. -cache: -- C:\ProgramData\chocolatey\bin -> .appveyor.yml -- C:\ProgramData\chocolatey\lib -> .appveyor.yml -- C:\Users\appveyor\.gvm -> .appveyor.yml -- C:\Windows\System32\gvm.exe -> .appveyor.yml - -# Scripts that run after cloning repository -install: - - ps: >- - if(!(Test-Path "C:\Windows\System32\gvm.exe")) { - wget "$env:GVM_DL" -Outfile C:\Windows\System32\gvm.exe - } - - ps: gvm --format=powershell "$env:GVM_GO_VERSION" | Invoke-Expression - # AppVeyor has MinGW64. Make sure it's on the PATH. - - set PATH=C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1;%GOROOT%\bin;%PATH% - - set PATH=%GOPATH%\bin;%PATH% - - go version - - go env - - cmd /C "set ""GO111MODULE=off"" && go get github.com/elastic/go-licenser" - - python --version - -before_build: -- go mod verify -- go-licenser -d -- go run .ci/scripts/check_format.go -- go run .ci/scripts/check_lint.go - -build_script: - # Compile - - appveyor AddCompilationMessage "Starting Compile" - - cd c:\gopath\src\github.com\elastic\go-windows - - go build - - appveyor AddCompilationMessage "Compile Success" - -test_script: - # Unit tests - - ps: Add-AppveyorTest "Unit Tests" -Outcome Running - - go test -v ./... - - ps: Update-AppveyorTest "Unit Tests" -Outcome Passed - -# To disable deployment -deploy: off - -# Notifications should only be setup using the AppVeyor UI so that -# forks can be created without inheriting the settings. diff --git a/vendor/github.com/elastic/go-windows/.gitattributes b/vendor/github.com/elastic/go-windows/.gitattributes deleted file mode 100644 index 875f499..0000000 --- a/vendor/github.com/elastic/go-windows/.gitattributes +++ /dev/null @@ -1,5 +0,0 @@ -# Treat all files in the Go repo as binary, with no git magic updating -# line endings. Windows users contributing to Go will need to use a -# modern version of git and editors capable of LF line endings. - -* -text diff --git a/vendor/github.com/elastic/go-windows/.gitignore b/vendor/github.com/elastic/go-windows/.gitignore deleted file mode 100644 index 3b38be3..0000000 --- a/vendor/github.com/elastic/go-windows/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Directories -/.vagrant -/.idea -/build - -# Files -.DS_Store -/*.iml -*.h - -# Editor swap files -*.swp -*.swo -*.swn - -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so -*.exe -*.test -*.prof -*.pyc -*.swp diff --git a/vendor/github.com/elastic/go-windows/.travis.yml b/vendor/github.com/elastic/go-windows/.travis.yml deleted file mode 100644 index 2a96a1a..0000000 --- a/vendor/github.com/elastic/go-windows/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -sudo: false - -language: go - -os: -- windows -- linux - -go: -- 1.12.x - -env: -- GO111MODULE=on - -go_import_path: github.com/elastic/go-windows - -before_install: -- GO111MODULE=off go get -u github.com/elastic/go-licenser - -script: -- go mod verify -- go-licenser -d -- go run .ci/scripts/check_format.go -- go run .ci/scripts/check_lint.go -- go test -v ./... diff --git a/vendor/github.com/elastic/go-windows/CHANGELOG.md b/vendor/github.com/elastic/go-windows/CHANGELOG.md deleted file mode 100644 index 68698e2..0000000 --- a/vendor/github.com/elastic/go-windows/CHANGELOG.md +++ /dev/null @@ -1,41 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -### Added - -### Changed - -### Deprecated - -### Removed - -### Fixed - -### Security - -## [1.0.1] - 2019-08-28 - -### Security - -- Load DLLs only from Windows system directory. - -## [1.0.0] - 2019-04-26 - -### Added - -- Add GetProcessMemoryInfo. #2 -- Add APIs to fetch process information #6. - - NtQueryInformationProcess - - ReadProcessMemory - - GetProcessImageFileName - - EnumProcesses -- Add GetProcessHandleCount to kernel32. #7 - -[Unreleased]: https://github.com/elastic/go-windows/compare/v1.0.1...HEAD -[1.0.1]: https://github.com/elastic/go-windows/v1.0.1 -[1.0.0]: https://github.com/elastic/go-windows/v1.0.0 diff --git a/vendor/github.com/elastic/go-windows/LICENSE.txt b/vendor/github.com/elastic/go-windows/LICENSE.txt deleted file mode 100644 index d645695..0000000 --- a/vendor/github.com/elastic/go-windows/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - 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. diff --git a/vendor/github.com/elastic/go-windows/NOTICE.txt b/vendor/github.com/elastic/go-windows/NOTICE.txt deleted file mode 100644 index 807d3ab..0000000 --- a/vendor/github.com/elastic/go-windows/NOTICE.txt +++ /dev/null @@ -1,5 +0,0 @@ -Elastic go-windows -Copyright 2017-2019 Elasticsearch B.V. - -This product includes software developed at -Elasticsearch, B.V. (https://www.elastic.co/). diff --git a/vendor/github.com/elastic/go-windows/README.md b/vendor/github.com/elastic/go-windows/README.md deleted file mode 100644 index 1140052..0000000 --- a/vendor/github.com/elastic/go-windows/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# go-windows - -[![Build Status](http://img.shields.io/travis/elastic/go-windows.svg?style=flat-square)][travis] -[![Build status](https://ci.appveyor.com/api/projects/status/remqhuw0jjguygc3/branch/master?svg=true)][appveyor] -[![Go Documentation](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)][godocs] - -[travis]: http://travis-ci.org/elastic/go-windows -[appveyor]: https://ci.appveyor.com/project/elastic-beats/go-windows/branch/master -[godocs]: http://godoc.org/github.com/elastic/go-windows - -go-windows is a library for Go (golang) that provides wrappers to various -Windows APIs that are not covered by the stdlib or by -[golang.org/x/sys/windows](https://godoc.org/golang.org/x/sys/windows). - -Goals / Features - -- Does not use cgo. -- Provide abstractions to make using the APIs easier. diff --git a/vendor/github.com/elastic/go-windows/Vagrantfile b/vendor/github.com/elastic/go-windows/Vagrantfile deleted file mode 100644 index 5f52954..0000000 --- a/vendor/github.com/elastic/go-windows/Vagrantfile +++ /dev/null @@ -1,30 +0,0 @@ -# NOTE: This is not a public image. It's only available within the Elastic -# organization and requires a 'vagrant login'. - -GO_VERSION = "1.12.4" - -# Provisioning for Windows PowerShell. -$winPsProvision = <