5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 18:29:53 +08:00

fix: fix go test errors (#2169)

* fix: fix go test errors

* Add flags to mac test

* Run on all branches

* Update PR workflow

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
This commit is contained in:
Misite Bao 2022-12-06 03:45:06 +08:00 committed by GitHub
parent 606ce3de1d
commit f70d9de366
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
125 changed files with 320 additions and 83 deletions

View File

@ -2,7 +2,7 @@ name: Build + Test
on:
push:
branches: [*]
branches: [release/*, master]
workflow_dispatch:
jobs:
@ -28,7 +28,15 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
- name: Run tests
- name: Run tests (mac)
if: matrix.os == 'macos-latest'
env:
CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13
working-directory: ./v2
run: go test -v ./...
- name: Run tests (!mac)
if: matrix.os != 'macos-latest'
working-directory: ./v2
run: go test -v ./...

View File

@ -48,7 +48,14 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
- name: Run tests
- name: Run tests (mac)
if: matrix.os == 'macos-latest'
env:
CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13
working-directory: ./v2
run: |
go test -v ./...
run: go test -v ./...
- name: Run tests (!mac)
if: matrix.os != 'macos-latest'
working-directory: ./v2
run: go test -v ./...

View File

@ -1,4 +1,4 @@
name: Push
name: Push Checks
on:
push:

View File

@ -2,6 +2,11 @@ package main
import (
"fmt"
"os"
"runtime"
"strings"
"time"
"github.com/leaanthony/slicer"
"github.com/pterm/pterm"
"github.com/wailsapp/wails/v2/cmd/wails/flags"
@ -10,10 +15,6 @@ import (
"github.com/wailsapp/wails/v2/internal/project"
"github.com/wailsapp/wails/v2/pkg/clilogger"
"github.com/wailsapp/wails/v2/pkg/commands/build"
"os"
"runtime"
"strings"
"time"
)
func buildApplication(f *flags.Build) error {
@ -167,12 +168,12 @@ func buildApplication(f *flags.Build) error {
switch buildOptions.Platform {
case "linux":
if runtime.GOOS != "linux" {
pterm.Warning.Println("Crosscompiling to Linux not currently supported.\n")
pterm.Warning.Println("Crosscompiling to Linux not currently supported.")
return
}
case "darwin":
if runtime.GOOS != "darwin" {
pterm.Warning.Println("Crosscompiling to Mac not currently supported.\n")
pterm.Warning.Println("Crosscompiling to Mac not currently supported.")
return
}
macTargets := targets.Filter(func(platform string) bool {

View File

@ -1,14 +1,15 @@
package main
import (
"runtime"
"runtime/debug"
"strings"
"github.com/pterm/pterm"
"github.com/wailsapp/wails/v2/cmd/wails/flags"
"github.com/wailsapp/wails/v2/internal/colour"
"github.com/wailsapp/wails/v2/internal/system"
"github.com/wailsapp/wails/v2/internal/system/packagemanager"
"runtime"
"runtime/debug"
"strings"
)
func diagnoseEnvironment(f *flags.Doctor) error {
@ -144,7 +145,7 @@ func diagnoseEnvironment(f *flags.Doctor) error {
if len(dependenciesMissing) == 0 && dependenciesAvailableRequired == 0 {
pterm.Println("Your system is ready for Wails development!")
} else {
pterm.Println("Your system has missing dependencies!\n")
pterm.Println("Your system has missing dependencies!")
}
if dependenciesAvailableRequired != 0 {

View File

@ -2,11 +2,12 @@ package main
import (
"fmt"
"github.com/pterm/pterm"
"github.com/wailsapp/wails/v2/cmd/wails/internal"
"os"
"strings"
"github.com/pterm/pterm"
"github.com/wailsapp/wails/v2/cmd/wails/internal"
"github.com/wailsapp/wails/v2/internal/colour"
"github.com/leaanthony/clir"
@ -52,7 +53,7 @@ func printFooter() {
},
}
printer.Println("If Wails is useful to you or your company, please consider sponsoring the project:")
pterm.Println("https://github.com/sponsors/leaanthony\n")
pterm.Println("https://github.com/sponsors/leaanthony")
}
func bool2Str(b bool) string {

View File

@ -2,12 +2,13 @@ package main
import (
"fmt"
"os"
"github.com/labstack/gommon/color"
"github.com/pterm/pterm"
"github.com/wailsapp/wails/v2/cmd/wails/flags"
"github.com/wailsapp/wails/v2/internal/colour"
"github.com/wailsapp/wails/v2/internal/shell"
"os"
"github.com/wailsapp/wails/v2/internal/github"
)
@ -76,7 +77,7 @@ func updateToVersion(targetVersion *github.SemanticVersion, force bool, currentV
var targetVersionString = "v" + targetVersion.String()
if targetVersionString == currentVersion {
pterm.Println("\nLooks like you're up to date!\n")
pterm.Println("\nLooks like you're up to date!")
return nil
}
@ -122,7 +123,8 @@ func updateToVersion(targetVersion *github.SemanticVersion, force bool, currentV
// Compare
if !success {
pterm.Println("Error: The requested version is lower than the current version.")
pterm.Println("If this is what you really want to do, use `wails update -version %s`", targetVersionString)
pterm.Println(fmt.Sprintf("If this is what you really want to do, use `wails update -version "+"%s`", targetVersionString))
return nil
}

View File

@ -1,9 +1,12 @@
//go:build windows
package windows
import (
"testing"
"github.com/wailsapp/wails/v2/internal/frontend"
"golang.org/x/sys/windows"
"testing"
)
func Test_calculateMessageDialogFlags(t *testing.T) {

View File

@ -1,10 +1,13 @@
//go:build windows
package w32
import (
"golang.org/x/sys/windows"
"syscall"
"unicode/utf16"
"unsafe"
"golang.org/x/sys/windows"
)
var (

View File

@ -1,3 +1,5 @@
//go:build windows
package combridge
import (

View File

@ -1,3 +1,5 @@
//go:build windows
package combridge
import (

View File

@ -1,3 +1,5 @@
//go:build windows
package combridge
import (

View File

@ -1,3 +1,5 @@
//go:build windows
package combridge
import (

View File

@ -1,3 +1,5 @@
//go:build windows
package combridge
import (

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
type COREWEBVIEW2_COLOR struct {

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
type COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND uint32

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
type COREWEBVIEW2_KEY_EVENT_KIND uint32

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
type COREWEBVIEW2_MOVE_FOCUS_REASON uint32

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
type COREWEBVIEW2_PHYSICAL_KEY_STATUS struct {

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
type COREWEBVIEW2_WEB_RESOURCE_CONTEXT uint32

View File

@ -1,8 +1,11 @@
//go:build windows
package edge
import (
"golang.org/x/sys/windows"
"unsafe"
"golang.org/x/sys/windows"
)
type _ICoreWebView2AcceleratorKeyPressedEventArgsVtbl struct {

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
type _ICoreWebView2AcceleratorKeyPressedEventHandlerVtbl struct {

View File

@ -1,10 +1,13 @@
//go:build windows
package edge
import (
"github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/go-webview2/internal/w32"
"golang.org/x/sys/windows"
"math"
"unsafe"
"github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/go-webview2/internal/w32"
"golang.org/x/sys/windows"
)
type _ICoreWebView2ControllerVtbl struct {

View File

@ -1,8 +1,11 @@
//go:build windows
package edge
import (
"golang.org/x/sys/windows"
"unsafe"
"golang.org/x/sys/windows"
)
type _ICoreWebView2Controller2Vtbl struct {

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
type _ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVtbl struct {

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
import (

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
import (

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
type _ICoreWebView2NavigationCompletedEventArgsVtbl struct {

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
type _ICoreWebView2NavigationCompletedEventHandlerVtbl struct {

View File

@ -1,8 +1,11 @@
//go:build windows
package edge
import (
"golang.org/x/sys/windows"
"unsafe"
"golang.org/x/sys/windows"
)
type _ICoreWebView2SettingsVtbl struct {

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
import (

View File

@ -1,8 +1,11 @@
//go:build windows
package edge
import (
"golang.org/x/sys/windows"
"unsafe"
"golang.org/x/sys/windows"
)
type _ICoreWebView2WebResourceRequestedEventArgsVtbl struct {

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
type _ICoreWebView2WebResourceRequestedEventHandlerVtbl struct {

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
import "unsafe"

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
type iCoreWebView2_2Vtbl struct {

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
import (

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
import (

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
import (

View File

@ -1,4 +1,4 @@
//go:build exp_gowebview2loader
//go:build windows && exp_gowebview2loader
package edge

View File

@ -1,4 +1,4 @@
//go:build !exp_gowebview2loader
//go:build windows && !exp_gowebview2loader
package edge

View File

@ -1,3 +1,5 @@
//go:build windows
package edge
// This code has been adapted from: https://github.com/go-ole/go-ole

View File

@ -1,4 +1,4 @@
//go:build exp_gowebview2loader
//go:build windows && exp_gowebview2loader
package webviewloader

View File

@ -1,4 +1,4 @@
//go:build exp_gowebview2loader
//go:build windows && exp_gowebview2loader
package webviewloader

View File

@ -1,3 +1,5 @@
//go:build windows
package webviewloader
import (

View File

@ -1,4 +1,4 @@
//go:build exp_gowebview2loader
//go:build windows && exp_gowebview2loader
package webviewloader

View File

@ -1,4 +1,4 @@
//go:build !exp_gowebview2loader
//go:build windows && !exp_gowebview2loader
package webviewloader

View File

@ -1,3 +1,5 @@
//go:build windows
package webviewloader
import (

View File

@ -1,3 +1,5 @@
//go:build windows
package windows
import (

View File

@ -1,8 +1,11 @@
//go:build windows
package win32
import (
"golang.org/x/sys/windows/registry"
"unsafe"
"golang.org/x/sys/windows/registry"
)
type DWMWINDOWATTRIBUTE int32

View File

@ -1,8 +1,9 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.
*/
package winc
import (

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
*/

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
*/

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
*/

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
*/

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
*/

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
*/

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
*/

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
*/

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
*/

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
*/

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
*/

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
*/

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
*/

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
*/

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
*/

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
*/

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.

View File

@ -1,3 +1,5 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2012 The W32 Authors. All Rights Reserved.

View File

@ -1,8 +1,9 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2012 The W32 Authors. All Rights Reserved.
*/
package w32
import (

View File

@ -1,8 +1,9 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2012 The W32 Authors. All Rights Reserved.
*/
package w32
const (

View File

@ -1,3 +1,5 @@
//go:build windows
package w32
import "syscall"

View File

@ -1,8 +1,9 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2012 The W32 Authors. All Rights Reserved.
*/
package w32
import (

View File

@ -1,8 +1,9 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2012 The W32 Authors. All Rights Reserved.
*/
package w32
import (

View File

@ -1,8 +1,9 @@
//go:build windows
/*
* Copyright (C) 2019 The Winc Authors. All Rights Reserved.
* Copyright (C) 2010-2012 The W32 Authors. All Rights Reserved.
*/
package w32
import (

View File

@ -1,8 +1,9 @@
//go:build windows
/*
* Copyright (C) 2019 Tad Vizbaras. All Rights Reserved.
* Copyright (C) 2010-2012 The W32 Authors. All Rights Reserved.
*/
package w32
import (

Some files were not shown because too many files have changed in this diff Show More