mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 12:46:46 +00:00
Other: go mod tidy/goimports/gofumpt after rebase on devel
This commit is contained in:
@ -30,7 +30,7 @@ func moveDir(from, to string) error {
|
|||||||
|
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
if entry.IsDir() {
|
if entry.IsDir() {
|
||||||
if err := os.Mkdir(filepath.Join(to, entry.Name()), 0700); err != nil {
|
if err := os.Mkdir(filepath.Join(to, entry.Name()), 0o700); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ func moveDir(from, to string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func move(from, to string) error {
|
func move(from, to string) error {
|
||||||
if err := os.MkdirAll(filepath.Dir(to), 0700); err != nil {
|
if err := os.MkdirAll(filepath.Dir(to), 0o700); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ func move(from, to string) error {
|
|||||||
}
|
}
|
||||||
defer func() { _ = f.Close() }()
|
defer func() { _ = f.Close() }()
|
||||||
|
|
||||||
if err := os.Chmod(to, 0600); err != nil {
|
if err := os.Chmod(to, 0o600); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,16 +27,16 @@ func TestMoveDir(t *testing.T) {
|
|||||||
from, to := t.TempDir(), t.TempDir()
|
from, to := t.TempDir(), t.TempDir()
|
||||||
|
|
||||||
// Create some files in from.
|
// Create some files in from.
|
||||||
if err := os.WriteFile(filepath.Join(from, "a"), []byte("a"), 0600); err != nil {
|
if err := os.WriteFile(filepath.Join(from, "a"), []byte("a"), 0o600); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if err := os.WriteFile(filepath.Join(from, "b"), []byte("b"), 0600); err != nil {
|
if err := os.WriteFile(filepath.Join(from, "b"), []byte("b"), 0o600); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if err := os.Mkdir(filepath.Join(from, "c"), 0700); err != nil {
|
if err := os.Mkdir(filepath.Join(from, "c"), 0o700); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if err := os.WriteFile(filepath.Join(from, "c", "d"), []byte("d"), 0600); err != nil {
|
if err := os.WriteFile(filepath.Join(from, "c", "d"), []byte("d"), 0o600); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -141,7 +141,7 @@ func getGluonDir(encVault *vault.Vault) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !exists {
|
if !exists {
|
||||||
if err := os.MkdirAll(encVault.GetGluonDir(), 0700); err != nil {
|
if err := os.MkdirAll(encVault.GetGluonDir(), 0o700); err != nil {
|
||||||
return "", fmt.Errorf("failed to create gluon dir: %w", err)
|
return "", fmt.Errorf("failed to create gluon dir: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -185,7 +185,7 @@ func newTestPersister(tb testing.TB) *testPersister {
|
|||||||
path := filepath.Join(tb.TempDir(), "cookies.json")
|
path := filepath.Join(tb.TempDir(), "cookies.json")
|
||||||
|
|
||||||
if _, err := os.Stat(path); errors.Is(err, fs.ErrNotExist) {
|
if _, err := os.Stat(path); errors.Is(err, fs.ErrNotExist) {
|
||||||
if err := os.WriteFile(path, []byte{}, 0600); err != nil {
|
if err := os.WriteFile(path, []byte{}, 0o600); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -198,5 +198,5 @@ func (p *testPersister) GetCookies() ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *testPersister) SetCookies(rawCookies []byte) error {
|
func (p *testPersister) SetCookies(rawCookies []byte) error {
|
||||||
return os.WriteFile(p.path, rawCookies, 0600)
|
return os.WriteFile(p.path, rawCookies, 0o600)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,11 +24,12 @@
|
|||||||
package proto
|
package proto
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||||
reflect "reflect"
|
|
||||||
sync "sync"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@ -8,6 +8,7 @@ package proto
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
context "context"
|
context "context"
|
||||||
|
|
||||||
grpc "google.golang.org/grpc"
|
grpc "google.golang.org/grpc"
|
||||||
codes "google.golang.org/grpc/codes"
|
codes "google.golang.org/grpc/codes"
|
||||||
status "google.golang.org/grpc/status"
|
status "google.golang.org/grpc/status"
|
||||||
|
|||||||
@ -212,12 +212,12 @@ func (f *frontendCLI) exportTLSCerts(c *ishell.Context) {
|
|||||||
if location := f.readStringInAttempts("Enter a path to which to export the TLS certificate used for IMAP and SMTP", c.ReadLine, f.isCacheLocationUsable); location != "" {
|
if location := f.readStringInAttempts("Enter a path to which to export the TLS certificate used for IMAP and SMTP", c.ReadLine, f.isCacheLocationUsable); location != "" {
|
||||||
cert, key := f.bridge.GetBridgeTLSCert()
|
cert, key := f.bridge.GetBridgeTLSCert()
|
||||||
|
|
||||||
if err := os.WriteFile(filepath.Join(location, "cert.pem"), cert, 0600); err != nil {
|
if err := os.WriteFile(filepath.Join(location, "cert.pem"), cert, 0o600); err != nil {
|
||||||
f.printAndLogError(err)
|
f.printAndLogError(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := os.WriteFile(filepath.Join(location, "key.pem"), key, 0600); err != nil {
|
if err := os.WriteFile(filepath.Join(location, "key.pem"), key, 0o600); err != nil {
|
||||||
f.printAndLogError(err)
|
f.printAndLogError(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,12 +24,13 @@
|
|||||||
package grpc
|
package grpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||||
wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
|
wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
|
||||||
reflect "reflect"
|
|
||||||
sync "sync"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@ -8,6 +8,7 @@ package grpc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
context "context"
|
context "context"
|
||||||
|
|
||||||
grpc "google.golang.org/grpc"
|
grpc "google.golang.org/grpc"
|
||||||
codes "google.golang.org/grpc/codes"
|
codes "google.golang.org/grpc/codes"
|
||||||
status "google.golang.org/grpc/status"
|
status "google.golang.org/grpc/status"
|
||||||
|
|||||||
@ -114,6 +114,7 @@ func NewCacheChangeLocalCacheFinishedEvent(willRestart bool) *StreamEvent {
|
|||||||
func NewDiskCachePathChanged(path string) *StreamEvent {
|
func NewDiskCachePathChanged(path string) *StreamEvent {
|
||||||
return cacheEvent(&CacheEvent{Event: &CacheEvent_DiskCachePathChanged{DiskCachePathChanged: &DiskCachePathChanged{Path: path}}})
|
return cacheEvent(&CacheEvent{Event: &CacheEvent_DiskCachePathChanged{DiskCachePathChanged: &DiskCachePathChanged{Path: path}}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMailSettingsErrorEvent(err MailSettingsErrorType) *StreamEvent {
|
func NewMailSettingsErrorEvent(err MailSettingsErrorType) *StreamEvent {
|
||||||
return mailSettingsEvent(&MailSettingsEvent{Event: &MailSettingsEvent_Error{Error: &MailSettingsErrorEvent{Type: err}}})
|
return mailSettingsEvent(&MailSettingsEvent{Event: &MailSettingsEvent_Error{Error: &MailSettingsErrorEvent{Type: err}}})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user