Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove all package-level flags #175

Merged
merged 2 commits into from
Aug 4, 2022

Conversation

ryanpbrewster
Copy link

Summary

This is my attempt to perform a minimally invasive purge of all package-level flags.

I would appreciate some input on:

  • whether any of the upstream repos that use this vitess fork will be impacted by these changes
  • whether this change should be more invasive (e.g., if you don't use the AuthServerClientCert it may be better to remove it entirely rather than just prune the flags)

Motivation

#174

Testing

I've removed all package-level flags:

ryanpbrewster@argon:~/p/g/dolthub-vitess$ rg "flag\.\w"
go/mysql/auth_server_clientcert.go
35:     if flag.CommandLine.Lookup("mysql_server_ssl_ca").Value.String() == "" {

The existing tests still pass:

ryanpbrewster@argon:~/p/g/dolthub-vitess$ go test go/...
ok      go/ast  (cached)
ok      go/build        (cached)
ok      go/build/constraint     (cached)
ok      go/constant     (cached)
ok      go/doc  (cached)
ok      go/format       (cached)
ok      go/importer     (cached)
ok      go/internal/gccgoimporter       (cached)
ok      go/internal/gcimporter  (cached)
ok      go/internal/srcimporter (cached)
?       go/internal/typeparams  [no test files]
ok      go/parser       (cached)
ok      go/printer      (cached)
ok      go/scanner      (cached)
ok      go/token        (cached)
ok      go/types        (cached)

@ryanpbrewster
Copy link
Author

I have run the test suite in go-mysql-server using this branch and all the tests still pass:

I updated go.mod in that repo to point at my branch

ryanpbrewster@argon:~/p/g/go-mysql-server$ git diff go.mod
diff --git a/go.mod b/go.mod
index 3287032b..014764ce 100644
--- a/go.mod
+++ b/go.mod
@@ -44,4 +44,6 @@ require (
 
 replace github.com/oliveagle/jsonpath => github.com/dolthub/jsonpath v0.0.0-20210609232853-d49537a30474
 
+replace github.com/dolthub/vitess => github.com/ryanpbrewster/vitess v0.0.0-20220803040637-d82e588f49ed
+
 go 1.18

and then ran the tests:

ryanpbrewster@argon:~/p/g/go-mysql-server$ go test ./...                                                
ok      github.com/dolthub/go-mysql-server      0.090s                                                  
ok      github.com/dolthub/go-mysql-server/benchmark    0.074s [no tests to run]                        
?       github.com/dolthub/go-mysql-server/driver       [no test files]                                 
ok      github.com/dolthub/go-mysql-server/enginetest   43.408s                                         
?       github.com/dolthub/go-mysql-server/enginetest/mysqlshim [no test files]                         
?       github.com/dolthub/go-mysql-server/enginetest/queries   [no test files]                         
?       github.com/dolthub/go-mysql-server/enginetest/scriptgen/cmd/scriptgen   [no test files]         
ok      github.com/dolthub/go-mysql-server/enginetest/scriptgen/setup   0.004s                          
?       github.com/dolthub/go-mysql-server/enginetest/sqllogictest      [no test files]                 
?       github.com/dolthub/go-mysql-server/enginetest/sqllogictest/harness      [no test files]         
ok      github.com/dolthub/go-mysql-server/internal/regex       (cached)                                
ok      github.com/dolthub/go-mysql-server/internal/similartext (cached)                                
?       github.com/dolthub/go-mysql-server/internal/sockstate   [no test files]                         
?       github.com/dolthub/go-mysql-server/internal/strings     [no test files]                         
ok      github.com/dolthub/go-mysql-server/memory       0.030s                                          
?       github.com/dolthub/go-mysql-server/optgen/cmd/optgen    [no test files]                         
ok      github.com/dolthub/go-mysql-server/optgen/cmd/support   (cached)                                
?       github.com/dolthub/go-mysql-server/scripts      [no test files]                                 
ok      github.com/dolthub/go-mysql-server/server       8.479s                                          
ok      github.com/dolthub/go-mysql-server/sql  0.334s                                                  
ok      github.com/dolthub/go-mysql-server/sql/analyzer 2.940s                                          
ok      github.com/dolthub/go-mysql-server/sql/expression       0.071s                                  
ok      github.com/dolthub/go-mysql-server/sql/expression/function      7.646s                          
ok      github.com/dolthub/go-mysql-server/sql/expression/function/aggregation  0.027s                  
?       github.com/dolthub/go-mysql-server/sql/expression/function/aggregation/window   [no test files] 
?       github.com/dolthub/go-mysql-server/sql/in_mem_table     [no test files]                         
?       github.com/dolthub/go-mysql-server/sql/information_schema       [no test files]                 
ok      github.com/dolthub/go-mysql-server/sql/mysql_db 0.021s                                          
?       github.com/dolthub/go-mysql-server/sql/mysql_db/serial  [no test files]                         
ok      github.com/dolthub/go-mysql-server/sql/parse    0.173s                                          
ok      github.com/dolthub/go-mysql-server/sql/parse/dateparse  (cached)                                
ok      github.com/dolthub/go-mysql-server/sql/plan     0.242s                                          
ok      github.com/dolthub/go-mysql-server/sql/transform        0.063s                                  
?       github.com/dolthub/go-mysql-server/sql/values   [no test files]                                 
?       github.com/dolthub/go-mysql-server/test [no test files]                                         

Copy link
Member

@zachmu zachmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

In favor of this overall. We want vitess to be a library, it shouldn't be defining application flags like this.

I need to do a little more digging to see if this is the right amount of changes before I merge this in.

@zachmu
Copy link
Member

zachmu commented Aug 4, 2022

Merging in, I have additional deletions I'll make a separate PR for.

@zachmu zachmu merged commit ef27562 into dolthub:main Aug 4, 2022
@zachmu zachmu mentioned this pull request Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants