git » chasquid » commit 7fa564f

smtpsrv: Add comment on BuildNameToCertificate being deprecated

author Alberto Bertogli
2020-05-13 22:28:09 UTC
committer Alberto Bertogli
2020-05-13 22:42:37 UTC
parent 70387207f23dd2875cf67efc1d509f4bb1eb3bf1

smtpsrv: Add comment on BuildNameToCertificate being deprecated

tls.Config.BuildNameToCertificate was deprecated in Go 1.14, and is no
longer necessary.

However, we support down to 1.11, so we will keep it for now.

This patch adds a TODO to remove it in the future once the minimum
supported version is 1.14; and adjust the CI linter accordingly.

.cirrus.yml +3 -1
internal/smtpsrv/server.go +2 -0

diff --git a/.cirrus.yml b/.cirrus.yml
index 6a873da..12f6746 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -53,7 +53,9 @@ lint_task:
               - errcheck
           - linters:
               - staticcheck
-            text: "SA1015:"
+            # SA1015: time.Tick leaks but it's ok on endless functions.
+            # SA1019: BuildNameToCertificate deprecation, remove on Go >= 1.14.
+            text: "SA1015:|SA1019:"
         exclude-use-default: true
   lint_config_file:
     path: /tmp/lint.yml
diff --git a/internal/smtpsrv/server.go b/internal/smtpsrv/server.go
index b688ff1..bd66140 100644
--- a/internal/smtpsrv/server.go
+++ b/internal/smtpsrv/server.go
@@ -202,6 +202,8 @@ func (s *Server) ListenAndServe() {
 
 	// At this point the TLS config should be done, build the
 	// name->certificate map (used by the TLS library for SNI).
+	// TODO: Once we support only Go >= 1.14, we can drop this, as it is no
+	// longer necessary.
 	s.tlsConfig.BuildNameToCertificate()
 
 	go s.periodicallyReload()