Skip to content

Commit

Permalink
Run gofmt to add new build constraints
Browse files Browse the repository at this point in the history
Also remove some 1.13 specific WASM code
  • Loading branch information
Sean-Der committed Jan 18, 2022
1 parent 04ca449 commit 157220e
Show file tree
Hide file tree
Showing 78 changed files with 94 additions and 43 deletions.
1 change: 1 addition & 0 deletions api.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions api_js.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build js && wasm
// +build js,wasm

package webrtc
Expand Down
1 change: 1 addition & 0 deletions api_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions certificate.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions certificate_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions configuration.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions configuration_js.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build js && wasm
// +build js,wasm

package webrtc
Expand Down
1 change: 1 addition & 0 deletions datachannel.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions datachannel_go_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
13 changes: 7 additions & 6 deletions datachannel_js.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build js && wasm
// +build js,wasm

package webrtc
Expand Down Expand Up @@ -162,7 +163,7 @@ func (d *DataChannel) Label() string {
// out-of-order delivery is allowed.
func (d *DataChannel) Ordered() bool {
ordered := d.underlying.Get("ordered")
if jsValueIsUndefined(ordered) {
if ordered.IsUndefined() {
return true // default is true
}
return ordered.Bool()
Expand All @@ -171,13 +172,13 @@ func (d *DataChannel) Ordered() bool {
// MaxPacketLifeTime represents the length of the time window (msec) during
// which transmissions and retransmissions may occur in unreliable mode.
func (d *DataChannel) MaxPacketLifeTime() *uint16 {
if !jsValueIsUndefined(d.underlying.Get("maxPacketLifeTime")) {
if !d.underlying.Get("maxPacketLifeTime").IsUndefined() {
return valueToUint16Pointer(d.underlying.Get("maxPacketLifeTime"))
} else {
// See https://bugs.chromium.org/p/chromium/issues/detail?id=696681
// Chrome calls this "maxRetransmitTime"
return valueToUint16Pointer(d.underlying.Get("maxRetransmitTime"))
}

// See https://bugs.chromium.org/p/chromium/issues/detail?id=696681
// Chrome calls this "maxRetransmitTime"
return valueToUint16Pointer(d.underlying.Get("maxRetransmitTime"))
}

// MaxRetransmits represents the maximum number of retransmissions that are
Expand Down
1 change: 1 addition & 0 deletions datachannel_js_detach.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build js && wasm
// +build js,wasm

package webrtc
Expand Down
1 change: 1 addition & 0 deletions dtlstransport.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions dtlstransport_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions e2e/e2e_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build e2e
// +build e2e

package main
Expand Down
1 change: 1 addition & 0 deletions examples/broadcast/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package main
Expand Down
1 change: 1 addition & 0 deletions examples/custom-logger/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package main
Expand Down
1 change: 1 addition & 0 deletions examples/data-channels-detach/jsfiddle/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build js && wasm
// +build js,wasm

package main
Expand Down
1 change: 1 addition & 0 deletions examples/data-channels/jsfiddle/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build js && wasm
// +build js,wasm

package main
Expand Down
1 change: 1 addition & 0 deletions examples/ice-single-port/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package main
Expand Down
1 change: 1 addition & 0 deletions examples/ice-tcp/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package main
Expand Down
1 change: 1 addition & 0 deletions examples/insertable-streams/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package main
Expand Down
1 change: 1 addition & 0 deletions examples/ortc/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package main
Expand Down
1 change: 1 addition & 0 deletions examples/play-from-disk-renegotation/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package main
Expand Down
1 change: 1 addition & 0 deletions examples/play-from-disk/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package main
Expand Down
1 change: 1 addition & 0 deletions examples/reflect/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package main
Expand Down
1 change: 1 addition & 0 deletions examples/rtcp-processing/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package main
Expand Down
1 change: 1 addition & 0 deletions examples/rtp-forwarder/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package main
Expand Down
1 change: 1 addition & 0 deletions examples/rtp-to-webrtc/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package main
Expand Down
1 change: 1 addition & 0 deletions examples/save-to-disk/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package main
Expand Down
1 change: 1 addition & 0 deletions examples/simulcast/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package main
Expand Down
1 change: 1 addition & 0 deletions examples/swap-tracks/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package main
Expand Down
1 change: 1 addition & 0 deletions examples/vnet/show-network-usage/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package main
Expand Down
1 change: 1 addition & 0 deletions ice_go.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions icegatherer.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions icegatherer_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions iceserver.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions iceserver_js.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build js && wasm
// +build js,wasm

package webrtc
Expand Down
1 change: 1 addition & 0 deletions iceserver_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions icetransport.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions icetransport_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions interceptor.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions interceptor_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
13 changes: 0 additions & 13 deletions js_compare.go

This file was deleted.

13 changes: 0 additions & 13 deletions js_compare_legacy.go

This file was deleted.

13 changes: 7 additions & 6 deletions js_utils.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build js && wasm
// +build js,wasm

package webrtc
Expand Down Expand Up @@ -42,15 +43,15 @@ func awaitPromise(promise js.Value) (js.Value, error) {
}

func valueToUint16Pointer(val js.Value) *uint16 {
if jsValueIsNull(val) || jsValueIsUndefined(val) {
if val.IsNull() || val.IsUndefined() {
return nil
}
convertedVal := uint16(val.Int())
return &convertedVal
}

func valueToStringPointer(val js.Value) *string {
if jsValueIsNull(val) || jsValueIsUndefined(val) {
if val.IsNull() || val.IsUndefined() {
return nil
}
stringVal := val.String()
Expand Down Expand Up @@ -79,28 +80,28 @@ func interfaceToValueOrUndefined(val interface{}) js.Value {
}

func valueToStringOrZero(val js.Value) string {
if jsValueIsUndefined(val) || jsValueIsNull(val) {
if val.IsUndefined() || val.IsNull() {
return ""
}
return val.String()
}

func valueToUint8OrZero(val js.Value) uint8 {
if jsValueIsUndefined(val) || jsValueIsNull(val) {
if val.IsUndefined() || val.IsNull() {
return 0
}
return uint8(val.Int())
}

func valueToUint16OrZero(val js.Value) uint16 {
if jsValueIsNull(val) || jsValueIsUndefined(val) {
if val.IsNull() || val.IsUndefined() {
return 0
}
return uint16(val.Int())
}

func valueToUint32OrZero(val js.Value) uint32 {
if jsValueIsNull(val) || jsValueIsUndefined(val) {
if val.IsNull() || val.IsUndefined() {
return 0
}
return uint32(val.Int())
Expand Down
1 change: 1 addition & 0 deletions mediaengine.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions mediaengine_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions ortc_datachannel_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions ortc_media_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions ortc_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions peerconnection.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions peerconnection_close_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
1 change: 1 addition & 0 deletions peerconnection_go_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !js
// +build !js

package webrtc
Expand Down
Loading

0 comments on commit 157220e

Please sign in to comment.