Coder Social home page Coder Social logo

gopherjs's People

Contributors

abrander avatar albrow avatar andybalholm avatar archs avatar canning-duck avatar damonchen avatar dmitshur avatar flimzy avatar hajimehoshi avatar jargv avatar jeremyschlatter avatar keipes avatar leitzler avatar maxdamantus avatar metakeule avatar myitcv avatar nathany avatar neelance avatar nevkontakte avatar nlacasse avatar nmiyake avatar nullstyle avatar ondrajz avatar readmecritic avatar rubenv avatar slimsag avatar steveoc64 avatar tenntenn avatar truefurby avatar visualfc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

gopherjs's Issues

Cannot consume v1.1.8 with Go1.15

When trying to pull down goplujs/gopherjs v1.1.8 with go mod using go1.15, I am seeing the following error:

regenvanwalbeek@cldr-go♜ go mod vendor
github.com/Workiva/cldr-go/scripts imports
        github.com/goplusjs/gopherjs imports
        github.com/goplusjs/gopherjs/build imports
        github.com/visualfc/goembed imports
        github.com/visualfc/goembed/resolve imports
        io/fs: package io/fs is not in GOROOT (/Users/regenvanwalbeek/dev/go/src/io/fs)

It looks like #13 introduced an import that relies on io/fs, so go mod can't pull that down with go 1.15. It looks like the build flag doesn't impact go mod.

As a workaround we're continuing to use 1.1.7

go:embed generate code change ast

//go:embed hello.txt
var hello string

current generate to

func init() {
    hello = string(_hello_data_)
}

must change ast to

var hello = string(_hello_data_)

reflect.Interface bug

package main

import (
	"fmt"
	"reflect"
)

type student struct {
	name string
}

func main() {
	a := []student{student{"A"}, student{"B"}, student{"C"}}
	v := reflect.ValueOf(a)
	i := v.Index(0).Interface()
	a[0] = student{"X"}
	fmt.Println(a, i)
}

want [{X} {B} {C}] {A}
got [{X} {B} {C}] {X}

support go1.16 embed

Go 1.16 embed demo

package main

import (
	"embed"
	"fmt"
)

//go:embed txt/hello.txt
var hello string

//go:embed txt/*
var fs embed.FS

func main() {
	fmt.Println(hello)
	fmt.Println(fs.ReadFile("txt/hello.txt"))
}

not working on macOS Big Sur M1

on a fresh install on macosx (m1 hw, Big Sur) does not work.

OS: macOS Big Sur 11.2.3
HW: Apple M1 8/8 - 16Gb.
go version : go.16.2 darwin/arm64

steps to reproduce the problem :

on fresh install, install gopherjs as per instructions : go get -u github.com/goplusjs/gopherjs, than try to build something with the usual "gopherjs build main.go" (main.go or whatever)

results :
../../../../../../src/syscall/syscall_darwin.go:225:25: undeclared name: libc_fstat64_trampoline
../../../../../../src/syscall/syscall_darwin.go:227:25: undeclared name: libc_fstatfs64_trampoline
../../../../../../src/syscall/syscall_darwin.go:231:25: undeclared name: libc_lstat64_trampoline
../../../../../../src/syscall/syscall_darwin.go:233:25: undeclared name: libc_stat64_trampoline
../../../../../../src/syscall/syscall_darwin.go:235:25: undeclared name: libc_statfs64_trampoline
../../../../../../src/syscall/syscall_darwin.go:239:25: undeclared name: libc_fstatat64_trampoline

Same result with "gopherjs server"

any suggestion how to fix or workaround the problem ?
thanks in advance

reflect.TypeOf(array).Size incorrect

package main

import (
	"fmt"
	"reflect"
	"unsafe"
)

type T [8]int

func main() {
	var t1 T
	var t2 [8]int
	fmt.Println(unsafe.Sizeof(t1))
	fmt.Println(unsafe.Sizeof(t2))
	fmt.Println(reflect.TypeOf(t1).Size())
	fmt.Println(reflect.TypeOf(t2).Size())
}

--- output ----

32
32
32
12

load time/tzdata must use -a flag

import _ "time/tzdata"
gopherjs server -a -v success
gopherjs server -v failed

test code

package main

import (
	"log"
	"time"
	_ "time/tzdata"
)

func main() {
	loc, err := time.LoadLocation("Asia/Baghdad")
	log.Println(loc, err)
}

Bad File Descriptor error when trying to open file in linux

When trying to open a file in a test running on linux (ubuntu:trusty), I get a bad file descriptor error. I've reproduced with both Go1.14 and Go1.15.

Error:

Error Trace:	
        	Error:      	Received unexpected error:
        	            	open testFile.js: bad file descriptor
        	Test:       	TestReadFile

Example test:

package read_file_test

import (
	"os"
	"testing"

	"github.com/stretchr/testify/require"
)

func TestReadFile(t *testing.T) {
	f, err := os.Open("testFile.js")

	require.NoError(t, err)
	require.NotNil(t, f)
}

I don't run into this problem on darwin (tested on 10.14.6). I also don't have this problem when using github.com/gopherjs/gopherjs. Is it possible some of the file i/o is regressed in the goplusjs fork?

I reproduced this with both node 10.22.1 and 11.15.0

support hiden interface

package main

import (
	"bytes"
	"io"
	"log"
)

// A version of bytes.Buffer without ReadFrom and WriteTo
type Buffer struct {
	bytes.Buffer
	io.ReaderFrom // conflicts with and hides bytes.Buffer's ReaderFrom.
	io.WriterTo   // conflicts with and hides bytes.Buffer's WriterTo.
}

func main() {
	b := new(Buffer)
	var i interface{} = b
	if v, ok := i.(io.WriterTo); ok {
		log.Println("error", v)
	}
}

---- output ------

error

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.