diff --git a/.gitignore b/.gitignore index e69de29b..5bf13d1a 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,176 @@ +# Created by https://www.toptal.com/developers/gitignore/api/go,terraform,intellij +# Edit at https://www.toptal.com/developers/gitignore?templates=go,terraform,intellij + +### Go ### +# If you prefer the allow list template instead of the deny list, see community template: +# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore +# +# 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 workspace file +go.work + +### Intellij ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +# https://plugins.jetbrains.com/plugin/7973-sonarlint +.idea/**/sonarlint/ + +# SonarQube Plugin +# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin +.idea/**/sonarIssues.xml + +# Markdown Navigator plugin +# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced +.idea/**/markdown-navigator.xml +.idea/**/markdown-navigator-enh.xml +.idea/**/markdown-navigator/ + +# Cache file creation bug +# See https://youtrack.jetbrains.com/issue/JBR-2257 +.idea/$CACHE_FILE$ + +# CodeStream plugin +# https://plugins.jetbrains.com/plugin/12206-codestream +.idea/codestream.xml + +# Azure Toolkit for IntelliJ plugin +# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij +.idea/**/azureSettings.xml + +### Terraform ### +# Local .terraform directories +**/.terraform/* + +# .tfstate files +*.tfstate +*.tfstate.* + +# Crash log files +crash.log +crash.*.log + +# Exclude all .tfvars files, which are likely to contain sensitive data, such as +# password, private keys, and other secrets. These should not be part of version +# control as they are data points which are potentially sensitive and subject +# to change depending on the environment. +*.tfvars +*.tfvars.json + +# Ignore override files as they are usually used to override resources locally and so +# are not checked in +override.tf +override.tf.json +*_override.tf +*_override.tf.json + +# Include override files you do wish to add to version control using negated pattern +# !example_override.tf + +# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan +# example: *tfplan* + +# Ignore CLI configuration files +.terraformrc +terraform.rc + +# End of https://www.toptal.com/developers/gitignore/api/go,terraform,intellij diff --git a/avro_test.go b/avro_test.go index 9839e27f..0a60bae4 100644 --- a/avro_test.go +++ b/avro_test.go @@ -1,6 +1,6 @@ package avro_test -import "github.com/hamba/avro/v2" +import "github.com/justtrackio/avro/v2" func ConfigTeardown() { // Reset the caches diff --git a/bench_test.go b/bench_test.go index ec9b1c0a..ab0b5820 100644 --- a/bench_test.go +++ b/bench_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" ) type Superhero struct { diff --git a/cmd/avrogen/main.go b/cmd/avrogen/main.go index 2009101e..a202759c 100644 --- a/cmd/avrogen/main.go +++ b/cmd/avrogen/main.go @@ -2,6 +2,8 @@ package main import ( "bytes" + "container/heap" + "encoding/json" "errors" "flag" "fmt" @@ -10,8 +12,8 @@ import ( "path/filepath" "strings" - "github.com/hamba/avro/v2" - "github.com/hamba/avro/v2/gen" + "github.com/justtrackio/avro/v2" + "github.com/justtrackio/avro/v2/gen" "golang.org/x/tools/imports" ) @@ -89,7 +91,14 @@ func realMain(args []string, stdout, stderr io.Writer) int { gen.WithFullSchema(cfg.FullSchema), } g := gen.NewGenerator(cfg.Pkg, tags, opts...) - for _, file := range flgs.Args() { + + files, err := sortFiles(flgs.Args()) + if err != nil { + _, _ = fmt.Fprintf(stderr, "Error: %v\n", err) + return 2 + } + + for _, file := range files { schema, err := avro.ParseFiles(filepath.Clean(file)) if err != nil { _, _ = fmt.Fprintf(stderr, "Error: %v\n", err) @@ -118,6 +127,167 @@ func realMain(args []string, stdout, stderr io.Writer) int { return 0 } +type doc struct { + Type avro.Type + Name string + Namespace string + Fields []field +} + +type field struct { + Name string + Type any +} + +type graph map[string]map[string]struct{} + +func sortFiles(args []string) ([]string, error) { + deps := make(graph) + + paths := make(map[string]string) + for _, filePath := range args { + file, err := os.Open(filepath.Clean(filePath)) + if err != nil { + return nil, err + } + + asBytes, err := io.ReadAll(file) + if err != nil { + return nil, err + } + + var doc doc + if err := json.Unmarshal(asBytes, &doc); err != nil { + return nil, err + } + + name := fmt.Sprintf("%s.%s", doc.Namespace, doc.Name) + paths[name] = filePath + + if _, ok := deps[name]; !ok { + deps[name] = make(map[string]struct{}) + } + + for _, f := range doc.Fields { + for _, dep := range getDependencies(f.Type) { + if !strings.Contains(dep, ".") { + dep = fmt.Sprintf("%s.%s", doc.Namespace, dep) + } + + if _, ok := deps[dep]; !ok { + deps[dep] = make(map[string]struct{}) + } + + deps[dep][name] = struct{}{} + } + } + } + + indegree := make(map[string]int) + for node := range deps { + indegree[node] = 0 + } + + for _, neighbours := range deps { + for neighbor := range neighbours { + indegree[neighbor]++ + } + } + + sorted, err := kahnTopologicSort(deps, indegree) + if err != nil { + return nil, err + } + + var sortedPaths []string + for _, it := range sorted { + if path, ok := paths[it]; ok { + sortedPaths = append(sortedPaths, path) + } else { + return nil, fmt.Errorf("could not find path for %s", it) + } + } + + return sortedPaths, nil +} + +type MinHeap []string + +func (h MinHeap) Len() int { return len(h) } +func (h MinHeap) Less(i, j int) bool { return h[i] < h[j] } +func (h MinHeap) Swap(i, j int) { h[i], h[j] = h[j], h[i] } +func (h *MinHeap) Push(x any) { + *h = append(*h, x.(string)) +} + +func (h *MinHeap) Pop() any { + old := *h + n := len(old) + x := old[n-1] + *h = old[:n-1] + return x +} + +func kahnTopologicSort(deps graph, indegree map[string]int) ([]string, error) { + queue := &MinHeap{} + heap.Init(queue) + + var result []string + + for node, deg := range indegree { + if deg == 0 { + heap.Push(queue, node) + } + } + + for queue.Len() > 0 { + front := heap.Pop(queue) + node := front.(string) + result = append(result, node) + + for neighbor := range deps[node] { + indegree[neighbor]-- + if indegree[neighbor] == 0 { + heap.Push(queue, neighbor) + } + } + } + + if len(result) != len(deps) { + return nil, fmt.Errorf("could not sort files, since they contain a cyclic dependency, or files are missing") + } + + return result, nil +} + +func isBuildIn(t string) bool { + switch avro.Type(t) { + case avro.String, avro.Bytes, avro.Fixed, avro.Int, avro.Long, avro.Double, avro.Boolean, avro.Null, avro.Float, avro.Array, avro.Map: + return true + } + + return false +} + +func getDependencies(t any) (deps []string) { + switch val := t.(type) { + case nil: + return deps + case string: + if !isBuildIn(val) { + deps = append(deps, val) + } + case []any: + for _, it := range val { + deps = append(deps, getDependencies(it)...) + } + case map[string]any: + deps = append(deps, getDependencies(val["type"])...) + } + + return +} + func writeOut(filename string, stdout io.Writer, bytes []byte) error { writer := stdout if filename != "" { diff --git a/cmd/avrogen/mytest/AnnotatedRevenueEvent.avsc b/cmd/avrogen/mytest/AnnotatedRevenueEvent.avsc new file mode 100644 index 00000000..cd9d5e1d --- /dev/null +++ b/cmd/avrogen/mytest/AnnotatedRevenueEvent.avsc @@ -0,0 +1,15 @@ +{ + "type": "record", + "name": "AnnotatedRevenueEvent", + "namespace": "io.justtrack.events.annotated", + "fields": [ + { + "name": "base", + "type": "io.justtrack.events.RevenueEvent" + }, + { + "name": "annotations", + "type": "Annotations" + } + ] +} \ No newline at end of file diff --git a/cmd/avrogen/mytest/Annotations.avsc b/cmd/avrogen/mytest/Annotations.avsc new file mode 100644 index 00000000..0bb00896 --- /dev/null +++ b/cmd/avrogen/mytest/Annotations.avsc @@ -0,0 +1,178 @@ +{ + "type": "record", + "name": "Annotations", + "namespace": "io.justtrack.events.annotated", + "fields": [ + { + "name": "adSetId", + "type": "int" + }, + { + "name": "adSetName", + "type": ["null", "string"], + "default": null + }, + { + "name": "adType", + "type": ["null", "string"], + "default": null + }, + { + "name": "advertiserId", + "type": ["null", "string"], + "default": null + }, + { + "name": "businessUnitId", + "type": "int" + }, + { + "name": "campaignId", + "type": "int" + }, + { + "name": "campaignType", + "type": ["null", "string"], + "default": null + }, + { + "name": "channelId", + "type": "int" + }, + { + "name": "clientId", + "type": "int" + }, + { + "name": "creativeId", + "type": ["null", "string"], + "default": null + }, + { + "name": "creativeName", + "type": ["null", "string"], + "default": null + }, + { + "name": "countryId", + "type": "int" + }, + { + "name": "deviceId", + "type": ["null", "string"], + "default": null + }, + { + "name": "exchangeId", + "type": ["null", "string"], + "default": null + }, + { + "name": "exchangeName", + "type": ["null", "string"], + "default": null + }, + { + "name": "externalAdSetId", + "type": ["null", "string"], + "default": null + }, + { + "name": "externalCreativeId", + "type": ["null", "string"], + "default": null + }, + { + "name": "globalNetworkId", + "type": "int" + }, + { + "name": "initialClientVersion", + "type": "int", + "default": 0 + }, + { + "name": "installAppVersionCode", + "type": ["null", "string"], + "default": null + }, + { + "name": "installAppVersionName", + "type": ["null", "string"], + "default": null + }, + { + "name": "isIncent", + "type": "boolean", + "default": false + }, + { + "name": "networkId", + "type": "int" + }, + { + "name": "platformId", + "type": "int" + }, + { + "name": "isRedownload", + "type": "boolean", + "default": false + }, + { + "name": "sourceBundleId", + "type": ["null", "string"], + "default": null + }, + { + "name": "sourceCategory", + "type": ["null", "string"], + "default": null + }, + { + "name": "sourceId", + "type": ["null", "string"], + "default": null + }, + { + "name": "sourceName", + "type": ["null", "string"], + "default": null + }, + { + "name": "sourcePlacement", + "type": ["null", "string"], + "default": null + }, + { + "name": "sourcePublisher", + "type": ["null", "string"], + "default": null + }, + { + "name": "sourceUrl", + "type": ["null", "string"], + "default": null + }, + { + "name": "userDate", + "type": ["null", + { + "type": "long", + "logicalType": "timestamp-micros" + } + ], + "default": null + }, + { + "name": "userType", + "type": ["null", "string"], + "default": null + }, + { + "name": "metricSources", + "type": ["null", "MetricSources"], + "default": null + } + ] +} \ No newline at end of file diff --git a/cmd/avrogen/mytest/Money.avsc b/cmd/avrogen/mytest/Money.avsc new file mode 100644 index 00000000..7997638e --- /dev/null +++ b/cmd/avrogen/mytest/Money.avsc @@ -0,0 +1,30 @@ +{ + "type": "record", + "name": "Money", + "namespace": "io.justtrack.events", + "fields": [ + { + "name": "currency", + "type": [ + "string", + "null" + ], + "default": "USD" + }, + { + "name": "value", + "type": ["double", "null"], + "default": 0.0 + }, + { + "name": "valueEur", + "type": "double", + "default": 0.0 + }, + { + "name": "valueUsd", + "type": "double", + "default": 0.0 + } + ] +} \ No newline at end of file diff --git a/cmd/avrogen/mytest/RevenueEvent.avsc b/cmd/avrogen/mytest/RevenueEvent.avsc new file mode 100644 index 00000000..0970c110 --- /dev/null +++ b/cmd/avrogen/mytest/RevenueEvent.avsc @@ -0,0 +1,115 @@ +{ + "type": "record", + "name": "RevenueEvent", + "namespace": "io.justtrack.events", + "fields": [ + { + "name": "id", + "type": "string" + }, + { + "name": "transactionId", + "type": "string" + }, + { + "name": "userUuid", + "type": "string" + }, + { + "name": "userInstallId", + "type": "string" + }, + { + "name": "userAdvertiserId", + "type": "string" + }, + { + "name": "userAttributionId", + "type": [ + "string", + "null" + ], + "default": "" + }, + { + "name": "monetizationBundleId", + "type": "string" + }, + { + "name": "monetizationInstanceName", + "type": "string" + }, + { + "name": "monetizationItemName", + "type": "string" + }, + { + "name": "monetizationItemType", + "type": "string" + }, + { + "name": "monetizationNetwork", + "type": "string" + }, + { + "name": "monetizationPlacement", + "type": "string" + }, + { + "name": "monetizationProvider", + "type": "string" + }, + { + "name": "monetizationSegment", + "type": "string" + }, + { + "name": "monetizationTestGroup", + "type": "string" + }, + { + "name": "monetizationType", + "type": "string" + }, + { + "name": "money", + "type": "Money" + }, + { + "name": "eventCount", + "type": "int" + }, + { + "name": "revenueType", + "type": "string", + "default": "Ad Revenue" + }, + { + "name": "source", + "type": "string", + "default": "import" + }, + { + "name": "purchaseEventId", + "type": [ + "null", + "string" + ], + "default": null + }, + { + "name": "happenedAt", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + }, + { + "name": "createdAt", + "type": { + "type": "long", + "logicalType": "timestamp-millis" + } + } + ] +} diff --git a/cmd/avrogen/testdata/golden_encoders.go b/cmd/avrogen/testdata/golden_encoders.go index 44b3e500..f5f744c5 100644 --- a/cmd/avrogen/testdata/golden_encoders.go +++ b/cmd/avrogen/testdata/golden_encoders.go @@ -2,7 +2,7 @@ package testpkg import ( - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" ) // Test is a test struct. diff --git a/cmd/avrogen/testdata/golden_encoders_fullschema.go b/cmd/avrogen/testdata/golden_encoders_fullschema.go index 7bc77367..7a1d4b5d 100644 --- a/cmd/avrogen/testdata/golden_encoders_fullschema.go +++ b/cmd/avrogen/testdata/golden_encoders_fullschema.go @@ -2,7 +2,7 @@ package testpkg import ( - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" ) // Test is a test struct. diff --git a/cmd/avrosv/main.go b/cmd/avrosv/main.go index bd32c58f..79288e71 100644 --- a/cmd/avrosv/main.go +++ b/cmd/avrosv/main.go @@ -6,7 +6,7 @@ import ( "io" "os" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" ) type config struct { diff --git a/cmd/avrosv/main_test.go b/cmd/avrosv/main_test.go index 3d85a06b..e404e33c 100644 --- a/cmd/avrosv/main_test.go +++ b/cmd/avrosv/main_test.go @@ -5,7 +5,7 @@ import ( "io" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" ) diff --git a/codec_convertible_test.go b/codec_convertible_test.go index 6f09f721..1a7a9358 100644 --- a/codec_convertible_test.go +++ b/codec_convertible_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/codec_marshaler_test.go b/codec_marshaler_test.go index b42d1acf..2a4a8b53 100644 --- a/codec_marshaler_test.go +++ b/codec_marshaler_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/codec_skip_test.go b/codec_skip_test.go index 54c41448..d03b78c6 100644 --- a/codec_skip_test.go +++ b/codec_skip_test.go @@ -4,7 +4,7 @@ import ( "bytes" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/decoder_array_test.go b/decoder_array_test.go index 2cb81a10..f344b31d 100644 --- a/decoder_array_test.go +++ b/decoder_array_test.go @@ -4,7 +4,7 @@ import ( "bytes" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/decoder_dynamic_test.go b/decoder_dynamic_test.go index 5b5684fd..0819a87c 100644 --- a/decoder_dynamic_test.go +++ b/decoder_dynamic_test.go @@ -4,7 +4,7 @@ import ( "bytes" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/decoder_enum_test.go b/decoder_enum_test.go index 0036a615..c26def03 100644 --- a/decoder_enum_test.go +++ b/decoder_enum_test.go @@ -5,7 +5,7 @@ import ( "errors" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/decoder_fixed_test.go b/decoder_fixed_test.go index ee5f1943..ac149109 100644 --- a/decoder_fixed_test.go +++ b/decoder_fixed_test.go @@ -7,7 +7,7 @@ import ( "math/big" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/decoder_map_test.go b/decoder_map_test.go index 8563a825..db2b0ca7 100644 --- a/decoder_map_test.go +++ b/decoder_map_test.go @@ -6,7 +6,7 @@ import ( "strconv" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/decoder_native_test.go b/decoder_native_test.go index 423b794c..d6d0a931 100644 --- a/decoder_native_test.go +++ b/decoder_native_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/decoder_record_test.go b/decoder_record_test.go index 69faf7c0..00d0dcbc 100644 --- a/decoder_record_test.go +++ b/decoder_record_test.go @@ -4,7 +4,7 @@ import ( "bytes" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/decoder_test.go b/decoder_test.go index 5ea727b4..37f87c4e 100644 --- a/decoder_test.go +++ b/decoder_test.go @@ -4,7 +4,7 @@ import ( "bytes" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" ) diff --git a/decoder_union_test.go b/decoder_union_test.go index 4af546be..e064715c 100644 --- a/decoder_union_test.go +++ b/decoder_union_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/encoder_array_test.go b/encoder_array_test.go index f877e6d8..dfd87994 100644 --- a/encoder_array_test.go +++ b/encoder_array_test.go @@ -4,7 +4,7 @@ import ( "bytes" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/encoder_enum_test.go b/encoder_enum_test.go index b7bc0232..a8a0d0ea 100644 --- a/encoder_enum_test.go +++ b/encoder_enum_test.go @@ -5,7 +5,7 @@ import ( "errors" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/encoder_fixed_test.go b/encoder_fixed_test.go index a4056891..085487a1 100644 --- a/encoder_fixed_test.go +++ b/encoder_fixed_test.go @@ -7,7 +7,7 @@ import ( "math/big" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/encoder_map_test.go b/encoder_map_test.go index fe241305..de0a7f66 100644 --- a/encoder_map_test.go +++ b/encoder_map_test.go @@ -6,7 +6,7 @@ import ( "strconv" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/encoder_native_test.go b/encoder_native_test.go index 435e0e2b..ceba43b7 100644 --- a/encoder_native_test.go +++ b/encoder_native_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/encoder_record_test.go b/encoder_record_test.go index 1aba99bc..da10149e 100644 --- a/encoder_record_test.go +++ b/encoder_record_test.go @@ -4,7 +4,7 @@ import ( "bytes" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/encoder_test.go b/encoder_test.go index 8f806012..15e7af5b 100644 --- a/encoder_test.go +++ b/encoder_test.go @@ -4,7 +4,7 @@ import ( "bytes" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/encoder_union_test.go b/encoder_union_test.go index 72c9d6e6..1c7f89b7 100644 --- a/encoder_union_test.go +++ b/encoder_union_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/example_resolver_test.go b/example_resolver_test.go index 311a0d35..3dc6a434 100644 --- a/example_resolver_test.go +++ b/example_resolver_test.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" ) func ExampleRegister() { diff --git a/example_simple_test.go b/example_simple_test.go index c2582412..b48902a8 100644 --- a/example_simple_test.go +++ b/example_simple_test.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" ) var Schema = `{ diff --git a/example_test.go b/example_test.go index cfafac20..3e7ea0d3 100644 --- a/example_test.go +++ b/example_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" ) func ExampleParse() { diff --git a/gen/gen.go b/gen/gen.go index 010fc85a..caddcc5a 100644 --- a/gen/gen.go +++ b/gen/gen.go @@ -13,7 +13,7 @@ import ( "unicode/utf8" "github.com/ettle/strcase" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "golang.org/x/tools/imports" ) @@ -124,7 +124,7 @@ func WithEncoders(b bool) OptsFunc { return func(g *Generator) { g.encoders = b if b { - g.thirdPartyImports = append(g.thirdPartyImports, "github.com/hamba/avro/v2") + g.thirdPartyImports = append(g.thirdPartyImports, "github.com/justtrackio/avro/v2") } } } @@ -242,7 +242,7 @@ func NewGenerator(pkg string, tags map[string]TagStyle, opts ...OptsFunc) *Gener } g.nameCaser = strcase.NewCaser( - true, // use standard Golint's initialisms + false, // use standard Golint's initialisms initialisms, nil, // use default word split function ) @@ -395,7 +395,7 @@ func (g *Generator) resolveLogicalSchema(logicalType avro.LogicalType) string { g.addImport("math/big") } if strings.Contains(typ, "avro") { - g.addThirdPartyImport("github.com/hamba/avro/v2") + g.addThirdPartyImport("github.com/justtrackio/avro/v2") } return typ } diff --git a/gen/gen_test.go b/gen/gen_test.go index cceede14..335473c2 100644 --- a/gen/gen_test.go +++ b/gen/gen_test.go @@ -9,8 +9,8 @@ import ( "strings" "testing" - "github.com/hamba/avro/v2" - "github.com/hamba/avro/v2/gen" + "github.com/justtrackio/avro/v2" + "github.com/justtrackio/avro/v2/gen" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/gen/testdata/golden.go b/gen/testdata/golden.go index 438b18af..fff4bcfd 100644 --- a/gen/testdata/golden.go +++ b/gen/testdata/golden.go @@ -5,7 +5,7 @@ import ( "math/big" "time" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" ) // InnerRecord is a generated struct. diff --git a/gen/testdata/golden_encoders.go b/gen/testdata/golden_encoders.go index 2539c388..c26a0c0a 100644 --- a/gen/testdata/golden_encoders.go +++ b/gen/testdata/golden_encoders.go @@ -5,7 +5,7 @@ import ( "math/big" "time" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" ) // InnerRecord is a generated struct. diff --git a/gen/testdata/golden_encoders_fullschema.go b/gen/testdata/golden_encoders_fullschema.go index fd012fa3..bc05972f 100644 --- a/gen/testdata/golden_encoders_fullschema.go +++ b/gen/testdata/golden_encoders_fullschema.go @@ -5,7 +5,7 @@ import ( "math/big" "time" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" ) // InnerRecord is a generated struct. diff --git a/gen/testdata/golden_fullname.go b/gen/testdata/golden_fullname.go index 877c698e..aa8e53d6 100644 --- a/gen/testdata/golden_fullname.go +++ b/gen/testdata/golden_fullname.go @@ -5,7 +5,7 @@ import ( "math/big" "time" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" ) // ACInnerRecord is a generated struct. diff --git a/gen/testdata/golden_logicaltype.go b/gen/testdata/golden_logicaltype.go index a32011f3..45524e59 100644 --- a/gen/testdata/golden_logicaltype.go +++ b/gen/testdata/golden_logicaltype.go @@ -6,7 +6,7 @@ import ( "time" "github.com/google/uuid" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" ) // InnerRecord is a generated struct. diff --git a/go.mod b/go.mod index 65ff924d..cfc66506 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ -module github.com/hamba/avro/v2 +module github.com/justtrackio/avro/v2 -go 1.22.0 +go 1.23.0 toolchain go1.23.1 diff --git a/internal/bytesx/reset_test.go b/internal/bytesx/reset_test.go index 229c6b6e..a011163b 100644 --- a/internal/bytesx/reset_test.go +++ b/internal/bytesx/reset_test.go @@ -4,7 +4,7 @@ import ( "io" "testing" - "github.com/hamba/avro/v2/internal/bytesx" + "github.com/justtrackio/avro/v2/internal/bytesx" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/ocf/example_test.go b/ocf/example_test.go index b8b014a7..2f87a9b4 100644 --- a/ocf/example_test.go +++ b/ocf/example_test.go @@ -4,7 +4,7 @@ import ( "log" "os" - "github.com/hamba/avro/v2/ocf" + "github.com/justtrackio/avro/v2/ocf" ) func ExampleNewDecoder() { diff --git a/ocf/ocf.go b/ocf/ocf.go index d980e4f8..d3026f5a 100644 --- a/ocf/ocf.go +++ b/ocf/ocf.go @@ -12,8 +12,8 @@ import ( "io" "os" - "github.com/hamba/avro/v2" - "github.com/hamba/avro/v2/internal/bytesx" + "github.com/justtrackio/avro/v2" + "github.com/justtrackio/avro/v2/internal/bytesx" ) const ( diff --git a/ocf/ocf_test.go b/ocf/ocf_test.go index 200a7798..f7dd8e2a 100644 --- a/ocf/ocf_test.go +++ b/ocf/ocf_test.go @@ -11,8 +11,8 @@ import ( "strings" "testing" - "github.com/hamba/avro/v2" - "github.com/hamba/avro/v2/ocf" + "github.com/justtrackio/avro/v2" + "github.com/justtrackio/avro/v2/ocf" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/protocol_test.go b/protocol_test.go index 3e96532b..22237938 100644 --- a/protocol_test.go +++ b/protocol_test.go @@ -3,7 +3,7 @@ package avro_test import ( "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/reader_generic_test.go b/reader_generic_test.go index ad8926ec..d61f4370 100644 --- a/reader_generic_test.go +++ b/reader_generic_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/reader_skip_test.go b/reader_skip_test.go index a8218807..db7239f0 100644 --- a/reader_skip_test.go +++ b/reader_skip_test.go @@ -4,7 +4,7 @@ import ( "bytes" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/reader_test.go b/reader_test.go index 2df3f8f5..d843685d 100644 --- a/reader_test.go +++ b/reader_test.go @@ -7,7 +7,7 @@ import ( "strconv" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/registry/client.go b/registry/client.go index a6e9981e..ee2987db 100644 --- a/registry/client.go +++ b/registry/client.go @@ -18,7 +18,7 @@ import ( "sync" "time" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" jsoniter "github.com/json-iterator/go" ) diff --git a/registry/client_test.go b/registry/client_test.go index 8363c9ad..89e32240 100644 --- a/registry/client_test.go +++ b/registry/client_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/hamba/avro/v2/registry" + "github.com/justtrackio/avro/v2/registry" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/registry/decoder.go b/registry/decoder.go index 1d605ef2..7fa5e2ae 100644 --- a/registry/decoder.go +++ b/registry/decoder.go @@ -6,7 +6,7 @@ import ( "errors" "fmt" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" ) // DecoderFunc is a function used to customize the Decoder. diff --git a/registry/decoder_internal_test.go b/registry/decoder_internal_test.go index 7faf213a..612a76b1 100644 --- a/registry/decoder_internal_test.go +++ b/registry/decoder_internal_test.go @@ -3,7 +3,7 @@ package registry import ( "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/registry/decoder_test.go b/registry/decoder_test.go index bfe5a135..fb5314f9 100644 --- a/registry/decoder_test.go +++ b/registry/decoder_test.go @@ -6,7 +6,7 @@ import ( "net/http/httptest" "testing" - "github.com/hamba/avro/v2/registry" + "github.com/justtrackio/avro/v2/registry" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/registry/example_test.go b/registry/example_test.go index 2b494962..9b7a551e 100644 --- a/registry/example_test.go +++ b/registry/example_test.go @@ -5,7 +5,7 @@ import ( "fmt" "log" - "github.com/hamba/avro/v2/registry" + "github.com/justtrackio/avro/v2/registry" ) func Example() { diff --git a/schema.go b/schema.go index b3b97d6e..11dcc068 100644 --- a/schema.go +++ b/schema.go @@ -12,7 +12,7 @@ import ( "sync" "sync/atomic" - "github.com/hamba/avro/v2/pkg/crc64" + "github.com/justtrackio/avro/v2/pkg/crc64" jsoniter "github.com/json-iterator/go" ) diff --git a/schema_canonical_test.go b/schema_canonical_test.go index 5d49c002..653b6a70 100644 --- a/schema_canonical_test.go +++ b/schema_canonical_test.go @@ -4,7 +4,7 @@ import ( "strconv" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/schema_compatibility_test.go b/schema_compatibility_test.go index 0b482543..112d53c8 100644 --- a/schema_compatibility_test.go +++ b/schema_compatibility_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/schema_json_test.go b/schema_json_test.go index 40f04ad5..8de44402 100644 --- a/schema_json_test.go +++ b/schema_json_test.go @@ -5,7 +5,7 @@ import ( "strconv" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/schema_test.go b/schema_test.go index cc8ccea0..e11d27f2 100644 --- a/schema_test.go +++ b/schema_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/writer_test.go b/writer_test.go index 428a7292..a160c72c 100644 --- a/writer_test.go +++ b/writer_test.go @@ -6,7 +6,7 @@ import ( "io" "testing" - "github.com/hamba/avro/v2" + "github.com/justtrackio/avro/v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" )